Friday, September 30, 2022
HomeGame Developmentunity - Get element of velocity parallel to a standard

unity – Get element of velocity parallel to a standard


I want to rework a rigidbody’s world velocity into a neighborhood velocity primarily based on a standard path.

When the rigidbody is shifting in direction of and inside a spread of a object, I exploit a raycast to find out the hit place and regular of the face it can collide with. I’ve the rate of the RB in world house, however I want to have it within the regular’s reference body.

I do know a Rework element can do InverseTransformDirection(), however seeing as the traditional is most definitely not aligned to its rework, this isn’t going to work.

I wish to know the rate an object collided with a face, however solely within the face’s regular path. The result of that is to use a power to the rigidbody within the regular’s path and thus stopping the rigidbody from shifting any nearer to the hit level. The power can be calculated by trying on the element of the rigidbody’s velocity that’s in the identical path the traditional. My considering is, that if I can get the RB velocity into the reference body of the traditional, it will likely be simply the UP element that I want to take a look at: the pace the RB is shifting alongside the traditional in direction of the hit level.

Should you can think about (all in world house) a ball dropping on the ground: when this ball is one radius away from the ground, there can be a contact level and the traditional can be perpendicular to the ground. To arrest the autumn of the ball, a power within the path of the traditional is utilized (so UP). The power of this power is the down element of the rate. If the ball was shifting horizontally whereas dropping, the DOWN element of the rate that matches the traditional path on this case is what I’m involved in.

Mainly I would like the rate of the RB that as seen from the traditional alongside its axis. Virtually like saying I wish to rework the world house velocity into a neighborhood mesh face house, however solely the UP axis.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments