addForce not working properly

https://streamable.com/6etgcg
video is too big so I uploaded it to another website
The red line is where a ray is being projected, a force is supposed to be acting where the ray is being thrown, however the rigid body is being forced from the front.

car:get(craft.rigidbody):applyForce(vec3(0, force * (2 - raycastRR.fraction), 0), car.position - (car.forward * 2.5) + (car.right * 2))

@Exyon Not sure what you’re doing, but here’s a little applyForce demo. Tap the screen and the force is applied from your finger to the circle forcing the circle away from your finger.


viewer.mode=FULLSCREEN

function setup()
    s1=physics.body(CIRCLE,5)
    s1.x=300
    s1.y=200
    s1.gravityScale=0
    fill(255)
end

function draw()
    background(40,40,50)
    ellipse(s1.x,s1.y,10)
end

function touched(t)
    if t.state==BEGAN then
        dx=(s1.x-t.x)/5
        dy=(s1.y-t.y)/5
        s1:applyForce(vec2(dx,dy))
    end
end

@dave1707 the video should be in the hyperlink.
My car is just a scene entity with a dynamic rigidbody, the above code is where i’m applying the force, however the front of the car is going up instead of the rear.

@Exyon I was able to see the video, but wasnt sure what you were trying to do. Not sure why the back isn’t reacting but the front is. I posted a little demo in the above post. Maybe you can get something from that.

@dave1707 The apply force from physics 2D are different from craft physics, i understand how it works and what i’m trying to do is stand the 4 corners of the plane as to act like suspension joints. I’m applying the force where the line is however the front is moving up, the seat has no mass so there’s no reason why it’s behaving that way.

@Exyon Ok, I’ll look into apply force using Craft.

@dave1707 I figured it out. The second argument for applyForce is relative to the rigidbody, so vec3(0,0,0) is the center of the body.
Here’s my fixed code

car:get(craft.rigidbody):applyForce(vec3(0, force * (2 - raycastFR.fraction), 0), vec3(2,0,2))

Glad you got it figured out. I didnt get to it yet, got tied up in other things.