Dear forum users! In compliance with the new European GDPR regulations, we'd just like to inform you that if you have an account, your email address is stored in our database. We do not share your information with third parties, and your email address and password are encrypted for security reasons.
New to the forum? Say hello in this topic!
Also make sure to read the rules
Did you encounter a problem, exploit, glitch or bug while playing the game or running the dedicated server software? Tell us about it here.
- Posts: 83
- Joined: Thu Feb 07, 2019 4:36 am
The grenade launcher projectile keep falling although I set it to the same position in the update loop
Code to reproduce
Code: Select all
private static IProjectile m_projectile;
public void OnStartup()
var me = Game.GetPlayers();
foreach (var p in ps)
if (p.ProjectileItem == ProjectileItem.GRENADE_LAUNCHER)
m_projectile = p;
if (m_projectile == null) return;
m_projectile.Position = Vector2.Zero; // set to any empty space position depend on your map
m_projectile.Velocity = Vector2.Zero;
EDIT: thanks to Ebomb09 on discord, I managed to solve this problem. Turn out it's just a quirk in the ScriptAPI. If you want to make the GrenadeLauncher projectile hover in the air. Simply set its velocity to Velocity(0, 100) as stated in IProjectile.Velocity's document
Code: Select all
Gets or Sets the current velocity that the projectile covers each second. Note: Sync over server-client assumes the velocity stays intact and changing this each update can make it look janky on clients. Note: You can not set a velocity greater than the max speed of the projectile and not set a velocity less than 100 in magnitude.
I assume that the 100 is to offset the gravity force. Because grenades motion are affected by gravity