applyImpulse help?

Hello everyone!
I am trying to more accurately “simulate” an ROV (underwater robot). To do this I need to be able to apply a force at the position of the thrusters. The applyImpulse function appears to be the ticket. Unfourtunatly it seems to have some problems. As a test I have two cubes, each with a thruster attached. One of these thrusters is far away from the cube, and the other is very close to its parent cube. The expected outcome would be for the cube with the thruster close to spin faster than the cube who’s thruster is far away. But in fact the opposite happens. Any ideas are greatly appreciated.

from bge import logic, render
import mathutils
cont = logic.getCurrentController()
own = cont.owner
children = own.children


for item in children:
    if 'thrust' in item:
        thruster = item
        lvect = thruster.getAxisVect(mathutils.Vector([.1,0,0]))


        own.applyImpulse(thruster.worldPosition, lvect) 

Screenshot:


parent will not work

use 6dof joints for the thrusters,

then just apply the force with the thrusters :smiley:

this is more realistic…

about your method, I have never used a position offset on apply impulse.

EDIT: it looks like you want offset

like

own.worldPosition-Thruster.worldPosition

but with this the parts must be “solidly” attached to the ROV. So 6dof wont work properly.

check it home skillet.
you needed

Force= Vector((own[‘Thrust’],0,0))

items.worldOrientation*Force

Attachments

CheckItHomeSlice.blend (578 KB)

Unfortunately this gives the same result. Moving some of the cubes farther from the parent still causes the parent to rotate much faster than the ones that are close. One way of doing it could be to have some invisible ghost-cubes with 6dof constraints and then have a visual object that looks like the thruster. Still, it seems as if this is not the intended action of the applyImpulse function.

try this?

it still may not be correct but it works

It looks like

item.worldPosition-own.worldPosition

is what you need however I could be mistaken

WASD-steer

Q-E thrust + -

Attachments

WorkingSub.blend (682 KB)

Monster, my file is working, you need the offset, not the worldPosition, I think.

This is inconvenient. It would be nice to have a function like you had mentioned in the one thread applyImpulse(loc, force(vector), local?)
Oh well. I suppose I will live with the 6dof. Thank you guys :slight_smile: