I think that this might apply:
You can check my app here:
http://alfredo.rhotonwa.com/secure/Room_challenge_entry.rar
(User name: guest, pass: darkbasicforum)
I did it by simply applying forces calculated by the distance from the object to the target antigravity point.
`Control PhysX Gun
rem if active_ray = 0 then temp = PICK OBJECT((screen width()/2)+25,(screen height()/2)+25, 1, 999)
if temp = 0 then temp = 5000
if phy get rigid body exist(temp) = 0 then temp = 5000
if active_ray = 1 then temp = ray_object
if object exist(temp) = 1
if phy get rigid body exist(temp) = 1
if phy get rigid body dynamic(temp)
if distance(temp,5002)<9
in_range = 1
if open_stage = 0 then play sound 57
inc open_stage,10
if open_stage >50 then open_stage = 50
else
in_range = 0
if open_stage = 50 then play sound 56
dec open_stage,10
if open_stage <0 then open_stage = 0
endif
else
in_range = 0
if open_stage = 50 then play sound 56
dec open_stage,10
if open_stage <0 then open_stage = 0
endif
else
in_range = 0
if open_stage = 50 then play sound 56
dec open_stage,10
if open_stage <0 then open_stage = 0
endif
else
in_range = 0
if open_stage = 50 then play sound 56
dec open_stage,10
if open_stage <0 then open_stage = 0
endif
set object frame PHYCANNON,open_stage * 1.8
if temp<>0
position object 5001,object position x(temp),object position y(temp),object position z(temp)
point object 5001,object position x(5002),object position y(5002),object position z(5002)
move object 5001,1
dx# = object position x(5001) - object position x(5002)
dy# = object position y(5001) - object position y(5002)
dz# = object position z(5001) - object position z(5002)
endif
if mouseclick() = 2 and active_ray = 0 and sc = 0
distance# = distance(temp,5002)
if distance#<5 and temp<>0
if phy get rigid body exist(temp) = 1 and phy get rigid body dynamic(temp) = 1
play sound 50
loop sound 52
active_ray = 1
ray_object = temp
c = 1
endif
endif
endif
if mouseclick() = 0 then sc = 0
if mouseclick() = 2 and c= 0
distance# = distance(temp,5002)
if active_ray = 0
if distance#<5 and phy get rigid body exist(temp) = 1
if phy get rigid body dynamic(temp) = 1
play sound 50
loop sound 52
active_ray = 1
ray_object = temp
phy set rigid body ccd ray_object,1
PHY SET RIGID BODY CCD MOTION THRESHOLD ray_object,1
endif
endif
else
active_ray = 0
play sound 51
stop sound 52
sc = 1
endif
endif
if active_ray = 1
temp4 = phy get rigid body mass(temp)
if temp4 >326 then temp4 = 326
mass_x = curvevalue(temp4,mass_x,2)
sprite 156,-326+mass_x,0,156
rem set sprite alpha 156,99
else
if temp4 >326 then temp4 = 326
mass_x = curvevalue(0,mass_x,8)
sprite 156,-326+mass_x,0,156
rem set sprite alpha 156,99
endif
if active_ray = 1
energy_radius = curvevalue(140,energy_radius,5)
distance# = distance(ray_object,5002)
rem if strain = 0
distance# = distance# * ((11-strain)*1)
rem else
rem distance# = distance# * 0.5
rem endif
rem text 0,0,str$(strain)
fx# = -dx# * distance#
fy# = -dy# * distance#
fz# = -dz# * distance#
rem if fx#>8 then fx# = 8
rem if fy#>8 then fy# = 8
rem if fz#>8 then fz# = 8
position object 5001,object position x(ray_object),object position y(ray_object),object position z(ray_object)
point object 5001,object position x(5002),object position y(5002),object position z(5002)
rem xa#=wrapvalue(CURVEANGLE(object angle x(5001), object angle x(ray_object), 0.0001))
rem ya#=wrapvalue(CURVEANGLE(object angle y(5001), object angle y(ray_object), 0.0001))
rem za#=wrapvalue(CURVEANGLE(object angle z(5001), object angle z(ray_object), 0.0001))
rem phy set rigid body rotation ray_object,xa#,ya#,za#
phy set rigid body linear velocity ray_object, 0,0,0
if distance#>0 then phy set rigid body linear velocity ray_object, fx#,fy#,fz#
rem if distance#>0.2 then phy add rigid body force ray_object, fx#,fy#,fz#, 5
endif
I know that my code is a bit of a mess, if you donĀ“t get something tell me. The physX gun is just a part of the whole app.
Hallowed are the ori.