Hi everyone! I’m creating a cannon and have run into some unexpected behaviour;
The 3 cannons on the left work but the rest don’t or have a small offset. I’m using the forward vector of an arrow (which points in the direction the cannon shoots) * by a float (speed) to shoot the cannonball along the current rotation of the cannon;
At a glance I’d say there’s Initial Speed and/or Velocity set for the Projectile Movement Component and it gets overriden with the physics call. Since you’re not rotating the actors, the initial Speed / Velocity tries to do its thing and then chaos ensues. A bit of a wild guess, though.
Can you show or explain how the projectiles work? Their hierarchy, too.
Also, must we use explicit physics call for this? Projectiles movement comp simulate it already. And pretty well, too. Do tell.
My projectile hierarchy as of right now looks like this:
There’s a small bit of code in the projectile blueprint but that relates to damaging an ai (the upper left cannon shows that).
The velocity on the ProjectileMovement component is set to 0, 0, 0 because I use the ForwardVector of the cannon to shoot it in the correct direction.
And to answer your last question, I’m open to all suggestions. I don’t work with physics too often… So please do tell if you have a better alternative!
And to answer your last question, I’m open to all suggestions. I don’t work with physics too often… So please do tell if you have a better alternative!
first i would try to disable collision on the cannons, just to see if the cannon balls are colliding with the cannons on launch (physics wont work if you disable collision on the balls)
second i would try what everynone suggested above, just set the rotation of the projectile and use initial velocity,
on my project, i had to add thse 2 IgnoreActor nodes after i spawn the projectile, here CapsuleCollison is your cannon’s collision component, and Self is the cannon