Im haveing trouble rotateing an object the way I want.
I have a center object that my camera rotates with, but what I want is another object that sits just to the left of it (20 value) that rotates with it and is always on its left side always faceing in the same direction as the other object does. I did some testing and searching and couldnt get it to work, any help would be appreciated.
Here is the code I use so far
hide mouse
sync on
sync rate 60
make object cube 1,10
position object 1,1250,25,1250
make matrix 3,25000,25000,150,150
make object cube 2,20
gheight#=0
do
Rem rotate
rotate#=object angle y(1)+(mousemovex()/2)
yrotate object 1,rotate#
Rem movement
if leftkey() then left#=curvevalue(20.0,left#,10.0)
if rightkey() then right#=curvevalue(20.0,right#,10.0)
if upkey() then move#=curvevalue(20.0,move#,10.0)
if downkey() then move#=curvevalue(-10.0,move#,10.0)
move object 1,move#
move object left 1,left#
move object right 1,right#
move object 2,move#
move object left 2,left#
move object right 2,right#
move#=curvevalue(0.0,move#,15.0)
left#=curvevalue(0.0,left#,15.0)
right#=curvevalue(0.0,right#,15.0)
set cursor 0,0
rem camera position
x# = object position x(1)
y# = object position y(1)
z# = object position z(1)
ay# = object angle y(1)
ax#=ax#+(mousemovey()/2)
if ax#>-90 and ax#<90 then look#=ax#
ax#=look#
y#=y#+gheight#
cx# = x#+150*cos(ax#)*sin(ay#)*-1
cy# = y#+150*sin(ax#)
cz# = z#+150*cos(ax#)*cos(ay#)*-1
position camera cx#,cy#,cz#
point camera x#,y#,z#
position object 2,x#-20,object position y(1),object position z(1)
rotate object 2,0,rotate#,0
sync
loop
Basically I just want the big box to always stay on the left of the smaller box when I use the mouse to rotate the box. So Its always in that fixed position that it is when the game starts. However I can move it around.