sync on
sync rate 0
global camera_x
global camera_y
camera_y = 100
global camera_z
make camera 1
position camera 1,camera_x, camera_y,camera_z
point camera 1,0, 0, 0
make matrix 1, 1000, 1000, 100, 100
position matrix 1, -500, 0, -500
make object cube 2, 5
color object 2, rgb(255,126, 0)
position object 2, 0, 0, 0
position object 2, 0, 2, 0
make object box 20,10,20,10
do
point object 20,object position x(2),0,object position z(2)
mouse(2)
sync
loop
function mouse(obj)
one = 1
two = 2
three = 3
four = 4
null = make vector3(one)
null = make vector3(two)
null = make vector3(three)
null = make vector3(four)
set vector3 one, 0, -1, 0
pick screen mousex(), mousey(), 1
px# = get pick vector x()
py# = get pick vector y()
pz# = get pick vector z()
set vector3 two, px#, py#, pz#
angle# = acos(dot product vector3(two, one))
cos_angle# = cos(angle#)
hypo_length# = camera_y / cos_angle#
normalize vector3 two, two
scale vector3 two, two, hypo_length#
set vector3 one, camera_x, camera_y, camera_z
add vector3 four, one, two
position object obj, x vector3(four), 2, z vector3(four)
endfunction
knocked that up quickly.
Forgot who the 3d mouse function is from, basically i just want to point the object at the box which is being placed at the mouse position.
Would i need to check for mouse move, then rotate the box according to how much the mouse has moved? But then how do i get the direction the object is facing in the first place to rotate the object?
I need it physical because the game i'm playing around with, he has to run through physics controlled doors and knock over boxes, i suppose i could control the character with DBPro commands then when he comes near to a box add a force to the box but it won't give the same feel as physics and wouldn't match the speed of the character.
[Looking for work]