I know I could do this by creating a pivot and using aligntovector and tformvector, but I'd really like to know a mathematical way to do this.
Let's say that you have a ball strike a surface. I want this ball to have a certain amount of elasticity to it. Say 0.5, meaning, that when the ball strikes a surface, it returns half the energy.
The problem is that if you do this, then a ball rolling along a surface will stop immediately.
The solution is to dampen only the ball's velocity which is in the Y direction of the space of the surface collided with. So that horizontal motion along a surface is unaffected, but if the ball falls straight down and hits the ground the majority of the force is in the direction of the surface normal and thus is dampened.
The a surface normal epresents only one axis, the Y axis, and there is no true X or Z axis direction.
I'm thinking that I can just do something with the normal of the surface... multiply it or something with the velcoity vector in some way after adjusting it somehow, and that's all I have to do. Maybe if I inverted the values of the normal on each axis, making 0 = 1 and 1 = 0... Hm.
Well I'm not sure what to do so I thought maybe someone else had already worked this out and will know what to do here.
Any suggestions?
Let's say that you have a ball strike a surface. I want this ball to have a certain amount of elasticity to it. Say 0.5, meaning, that when the ball strikes a surface, it returns half the energy.
The problem is that if you do this, then a ball rolling along a surface will stop immediately.
The solution is to dampen only the ball's velocity which is in the Y direction of the space of the surface collided with. So that horizontal motion along a surface is unaffected, but if the ball falls straight down and hits the ground the majority of the force is in the direction of the surface normal and thus is dampened.
The a surface normal epresents only one axis, the Y axis, and there is no true X or Z axis direction.
I'm thinking that I can just do something with the normal of the surface... multiply it or something with the velcoity vector in some way after adjusting it somehow, and that's all I have to do. Maybe if I inverted the values of the normal on each axis, making 0 = 1 and 1 = 0... Hm.
Well I'm not sure what to do so I thought maybe someone else had already worked this out and will know what to do here.
Any suggestions?