Getting a new physics vector from a physics vector and new rotation

I am working on a snowboarder character blueprint with gravity enabled on the mesh. Right now my actor slides down the slope, but of course rotation does not affect the direction of the actor’s velocity so he always slides straight. Simply adding a force vector left and right when pressing ‘a’ and ‘d’ does not achieve the right effect. How would I get the mesh’s velocity and apply its ‘VectorLength’ to the mesh’s current rotation? So far I have the velocity vector and the forward vector, but I cannot figure out the rest of the math.

Thank you in advance.

Interesting video to watch to understand the physics of snowboarding better, lots of different things come into play if you want to try and get some accurate physics going. Even if you don’t go with proper physics still good to account for them with your faked physics. I did a little version a while back that used physics materials and physx to do a snowboarding character and you can do some thrusts to fake things for the turns fairly well but I don’t think I would actually build a full game like that.

Personally I think I would be faking all of the physics entirely to make a proper snowboarding game because you just can’t rely on Physx to be able to calculate these things accurately.

For what you are trying to do there have you tried setting the forward vector to match the rotation of your character? Obviously you will need more complex stuff in there to adjust that but that should get your basic rotation turning it the way you want.

Thank you for the link! I am a pretty good snowboarder myself so I understand a lot of the physics involved. I do plan on faking what physics I need to fake, but certain things do need to react properly - like the snowboard with the ground, some of the body part physics, etc. I am having better luck after setting the character movement component default state to “custom”, which disables gravity on the component, and then enabling physics with gravity enabled on the snowboard itself with the skeletal mesh as a child. However, I still need to convert the velocity vector from straight downhill to the character’s forward vector.

Seems like it should make for an interesting mechanism for it, would love to see your progress. I didn’t go too far with mine as I was just doing some tech demo’s for Virtual Reality and decided I wanted more control than I had time to get with physics but definitely it was interesting to try out with pure physics going on it.

I am starting to get it working. It’s not necessarily pretty, but he slides down the hill using physics and rotating him will adjust his velocity vector to his rotation while maintaining his velocity. It’s the first big step I have made in the right direction.

Here is the blueprint script…

Here is how the character is setup - still using the aforementioned physics settings on the mesh and character movement.

This shows his path using a debug line trace…


I think the character pose needs work, but after all, he is still learning. :wink:

Hah yep he definitely looks like a beginner, be careful he doesn’t catch his edge and do a faceplant!

Interesting way of showing a debug line for where he has moved btw!

Mixing physics overwrite with physics simulation will give you some weird glitches down the road.
And you break physics each time you rotate it trough blueprint directly.

Your original problem started because you do not understand basic kindergarten problem, that is how do i rotate carousel.
You applied only one force (because unreal physics simulation is not perfect) and on top of that you applied it near center of mass.
No wonder that guy did not rotated.

To rotate with physics you need 2 THRUSTERS (because they do not need per tick action), put one ahead of character one behind. Both should face to right side, and autoactivate. Set forward one strength to +something and rear one to -something, it will nicely turn.

Then calculate normal of ground surface below character, by tracing 3 points and doing cross product. When you have normal vector, project it on flat horizontal plane, you will have direction vector of slope, calculate angle (from up vector [0,0,1] and your slope vector dot product of them is cosinus of that angle). From cos calculate pushing force. Add that as force (or thruster) to your character.

So either go full for scripted trough blueprints movement, or go full physics. Do not break physics simulation with overwriting location or rotation values.

I did not overwrite any locations or rotations. I overwrote the velocity vector and added to rotation using sweep. So far it is working the way I want without any physics problems, but I am missing detail that will improve the motion.

Thank you for your analogy, but please do not tell me I don’t understand basic physics.

I am actually applying force and rotation to the snowboard, which is not the characters center of mass.

Thank you for this information! I might give it a try. Do you think it would be better to have the thrusters at the characters feet? Since the feet are what are used to “thrust” rotation while snowboarding.

I just did this and it looks awesome. Much smoother rotation. I will try some of your other suggestions Nawrot.

Any tutorial or share this project? I´m new in UE4 and I´m looking for snowboard movement. Thanks

Same. Did you find anything?