This is exactly what I have been looking for, unfortunately it does not appear to work for me.
Using the following code, the results are not as expected -
local forceMagnitude = 100
local angle = ball.rotation
xForce = math.cos(angle)*forceMagnitude
yForce = math.sin(angle)*forceMagnitude
Using an example angle of 45 the results are -
xForce = 52.532198881773
yForce = 85.090352453412
When increasing the angle to just 46 the results are -
xForce = -43.217794488478
yForce = 90.178834764881
I may be missing something really obvious, but surely it shouldn’t be jumping to a negative figure after just one degree.
Any help would be greatly appreciated. [import]uid: 49987 topic_id: 11016 reply_id: 40185[/import]
I am having the very same problem! I tried this code out a couple times but no success … I have been looking for this FOR A VERY LONGTIME. And now i found it but its not working! I have an object names “snow” and ball is going to hit it. Snow’s rotation is always different, and i need to add a linear impulse instead of a force. Do i need any collision functions? Basically when ball hits snow let’s say snow is 45 degrees, then ball would have a linear impulse in the direction of 45 degrees wherever snow is pointing.
Thanks a lot!
I WOULD REALLY LOVE ANY HELP. [import]uid: 23689 topic_id: 11016 reply_id: 49656[/import]
I am having the very same problem! I tried this code out a couple times but no success … I have been looking for this FOR A VERY LONGTIME. And now i found it but its not working! I have an object names “snow” and ball is going to hit it. Snow’s rotation is always different, and i need to add a linear impulse instead of a force. Do i need any collision functions? Basically when ball hits snow let’s say snow is 45 degrees, then ball would have a linear impulse in the direction of 45 degrees wherever snow is pointing.
Thanks a lot!
I WOULD REALLY LOVE ANY HELP. [import]uid: 23689 topic_id: 11016 reply_id: 49657[/import]