I'm trying to draw a sphere on the bullets position every 1 seconds while it is in the air, but it draws the sphere at worldcoords(0,0,0) does someone know what I am doing wrong.
Thank you.
Code:void OnWeaponFired(BaseProjectile baseProjectile, BasePlayer player, ItemModProjectile projectile, ProtoBuf.ProjectileShoot projectiles) { Puts("OnWeaponFired works!"); timer.Repeat(1f, 5, () => drawSphere(baseProjectile, player, projectile, projectiles)); } public void drawSphere(BaseProjectile baseProjectile, BasePlayer player, ItemModProjectile projectile, ProtoBuf.ProjectileShoot projectiles) { Puts(baseProjectile.transform.position.ToString()); player.SendConsoleCommand("ddraw.sphere", 0.5f, Color.red, baseProjectile.transform.position, 1f); }![]()
Getting projectile posistion while projectile is in flight
Discussion in 'Rust Development' started by Carbonade, Jul 27, 2015.
-
Code:
void OnWeaponFired(BaseProjectile baseProjectile, BasePlayer player, ItemModProjectile projectile, ProtoBuf.ProjectileShoot projectiles) { var prefab = projectile.projectileObject?.Get(); var projectile2 = prefab?.GetComponent<Projectile>(); timer.Repeat(1f, 5, () => Puts(projectile2.currentPosition.ToString()); }
BUT this value is Private......and dont work -
Wulf Community Admin
Use reflection. -
It won't help him. I did this and it still returned 0 0 0.
-
Yep tried it. Still 0 0 0 . that gets me in mind..... you can turn on the " vis.attack " in your console . is there not any way to use that ?
