View Full Version : Rotate a pawn around an instigator relative to instigators position/rotation

11-30-2011, 01:47 AM

Trying to move a pawn (physics gun imitation) relative to actors rotation/position.

Originally, the gun uses SetLocation, which teleports a pawn and causes many collision errors and detection errors .
Switching to Move allows the pawn that is being moved to have full collision detection to world geometry but I am having many troubles with imitating the physics gun and how you hold the pawn

The biggest issue is rotating the held pawn relative to your own rotation.

Any ideas? Thanks a lot in advance!

11-30-2011, 11:13 AM
your actor location would be your instigator location + (x axis vector tranformed by instigator aim rotation) * disired distanceoffset(initially equal to current distance at trace).I say desired distance because you can always make some command to increase decrease your lasso lenght from the traced distance.

From that final position you have to calculate the direction between the old one and this one as normal(old-new)* desired speed * deltatime to get the delta movement to feed move or movesmooth(They could perform very differently in your case).

the most crucial parameter is how you calculate desired speed. you really need to smooth out and tune that param to make the movement beliveable.
You can also smooth the final destination against the old one.
I leave you with the calculation of proper speed to make some fluid motion.

edited because i made a wrong answer feeding move directly with a smoothed final destination that could lie to very big deltas.It could happen when you guess things without to test them.