Recently I've been playing around with the "shooter" code, and I tried replacing the balls with a ray cast function. I managed to implement it, but I'm running into a problem when I target the ground.
if phy get ray cast hit() = 1
hitObject = phy get ray cast object()
phy set rigid body linear velocity hitObject, 150*sin(angy#)*cos(angx#),150*sin(angx#),150*cos(angy#)*cos(angx#)
endif
Whenever I target the ground, it crashes because the engine tries to add force to a static object. I tried to get around it by this:
if phy get ray cast hit() = 1
hitObject = phy get ray cast object()
endif
[b]if not hitObject = ground[/b]
phy set rigid body linear velocity hitObject, 150*sin(angy#)*cos(angx#),150*sin(angx#),150*cos(angy#)*cos(angx#)
endif
This sort of solved my problem, but now it isn't applying force to anything at all, including dynamic bodies.
Does anyone have an idea on how I could fix this?
Thanks in advance