Question about spawning instance orientation and odd bug

Hi, I was doing the Warehouse Wreckage class and thought I’d try to make a projectile closer to a javelin than a cannonball so I used a cylinder and changed the scales but I had two problems…

  1. I couldn’t figure out how to have the instance of the BP class spawn oriented parallel to the ground like throwing a javelin, it would spawn straight up and down like a staff. I couldn’t find a way to orient the rotation of the BP class in the details. Even adjusting the cylinder the way I wanted it before making the BP didn’t work either. Finally, I tried finding a way to have the instance change the rotation after spawning but before executing the impulse and it just made the javelin throw at a different angle, not oriented at a different angle. Here is the blueprint code, basically the same from the class, without any edits


  2. Secondly, when the scale of the cylinder was default, it behaved as expected although the orientation wasn’t how I wanted
    test 1
    … but once I changed the scale and it made it long and skinny, it had these really odd reactions of spinning wildly or on its edge, any clue how to have this have otherwise normal physics but closer to the shape of a staff than a trashcan?
    test 2
    It’s possible that part of this is the instance is spawning in the ground when I throw it because it is taller than the player but any suggestions?

Figured out part of this… now I see why they call this spaghetti code lol

I basically just added a node that changed the local rotation by 90 degrees after spawning in, that solved the orientation
test 2

So I attempted to attack the scale and odd glitch thing… here is the BP, I changed the scale by doing a set actor scale node, and that made it spawn with the correct scale.


…and I attempted to have the projectile spawn ahead of and above and slightly to the side of the player so it would not clip the player on spawning and that helped it get thrown in the way I was aiming(haha) for… as you can see it still spins odd sometimes when landing and i thought that might be from a high impulse speed but it does it even when lowering the impulse and mass but hey it throws like a spear now :slight_smile:
test 5

Privacy & Terms