Hi all. Does anyone know how to determine the world position of a player's held weapon? I'm trying to run a server effect at said position, but I can't seem to resolve it. The closest I've been able to get is near the player's feet. I've tried a number of methods on the weapon as BaseEntity, BaseProjectile, HeldEntity, weapon.model.transform.position, etc, but to no avail. And after digging through the libraries for too long, I've still not found a solution... Any help is greatly appreciated!
Solved Determine world position of held weapon
Discussion in 'Rust Development' started by ignignokt84, Feb 15, 2017.
-
Code:
BaseEntity entity = player.GetHeldEntity(); Puts("Location Of Held: {0}", entity.transform.position); //Returns the held location of the entity/weapon?!?
-
Thanks, but I tried that, and it was returning a position closer to the player position than the actual weapon position. Anyway, I found a workaround - instead of trying to find the position of the weapon, I can pass the weapon entity directly to Effect.server.Run:
Code:Effect.server.Run(effectString, weaponEntity, StringPool.closest, Vector3.zero, Vector3.zero);
-