[ad_1]
I want to rework a rigidbody’s world velocity into an area velocity based mostly on a traditional course.
When the rigidbody is transferring 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 would collide with. I’ve the speed of the RB in world area, however I want to have it within the regular’s reference body.
I do know a Transform part can do InverseTransformRoute(), however seeing as the conventional is probably not aligned to its rework, this isn’t going to work.
I wish to know the speed an object collided with a face, however solely within the face’s regular course. The consequence of that is to use a drive to the rigidbody within the regular’s course and thus stopping the rigidbody from transferring any nearer to the hit level. The drive will likely be calculated by trying on the part of the rigidbody’s velocity that’s in the identical course the conventional. My pondering is, that if I can get the RB velocity into the reference body of the conventional, it is going to be simply the UP part that I would like to have a look at: the velocity the RB is transferring alongside the conventional in direction of the hit level.
If you may think about (all in world area) a ball dropping on the ground: when this ball is one radius away from the ground, there will likely be a contact level and the conventional will likely be perpendicular to the ground. To arrest the autumn of the ball, a drive within the course of the conventional is utilized (so UP). The power of this drive is the down part of the speed. If the ball was transferring horizontally whereas dropping, the DOWN part of the speed that matches the conventional course on this case is what I’m curious about.
Basically I need the speed of the RB that as seen from the conventional alongside its axis. Almost like saying I wish to rework the world area velocity into an area mesh face area, however solely the UP axis.
[ad_2]