Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: curb47 on September 03, 2020, 01:29:39 AM
-
Hello there,
I'm trying to work out how to return a value of the impact force created when my spaceship hits the ground, however, I only want to consider the vector at a tangent to the point of impact.
I have experimented with the Store Force parameter in Collision Event, and Collision Event Plus, but the stored value is accumulative of all vectors, so gives me an unusable result. I've also tried Get Collision Info, with Relative Velocity & Contact Normal, but I can't get the data I need.
And I've looked into Vector Magnitude, but I have no idea what to do with it.
Here's some clarity...
(https://i.postimg.cc/9FSS3vgM/tangent-force.jpg)
My space ship is whizzing along at 440, and gracefully descending at 30. If the space ship makes contact at point A on the ground, the Y vector (30) is the considered factor, and it does no damage, and the ship can carry on skimming the surface (imagine it has little wheels, or skids). However, if the ship slams into the edge of the ground plane at point B, the X vector (440) is used and the ship takes massive damage.
At the moment, when I swoop my little ship along the ground, it takes massive damage as the Force is using both X and Y. Make sense?
Basically, I want to return a single float value (not vector3 variable) that I can use to determine if, and how much, damage the ship takes when it makes contact with the ground.
As always, thank you in advance for any help.
Cheers.
-
Okay, so this is what I ended up doing, it's kinda ugly and convoluted but it works.
Essentially, using the Get Collision Info action, I multiplied the Relative Velocity by the Contact Normal. Both are Vector3, so first I had to split the variables out into the individual X and Y (ignoring Z, not relevant).
Contact Normal just returns a value of 0 or 1 on the vector the collision took place, so the Zero cancels out the unwanted vector value.
After the splitting of all the vector3 X and Y values, the multiplication by 0 and 1, just add the 2 resulting float values (one will be 0) and boom, job done.
If any of you have a more economic way of getting this value, please let me know.
(https://i.postimg.cc/rpV5sY32/Screen-Shot-2020-09-04-at-05-46-06.png)
(https://i.postimg.cc/66vYGqYW/Screen-Shot-2020-09-04-at-05-46-25.png)