I wouldn't use these commands for this purpose as there are much easier ways to do it... in fact this is remarkably difficult using these commands!
The help for EZro_objRotateSurfToSurf says the following (maybe it will help):
Quote: "
This command will rotate your object from any surface toward another surface by the angle specified. The surfaces are specified using normals. You can easily find the normal of a surface by using the EZro_FindNormal command.
An example usage of this command would be to rotate a ship to land on a landing pad. Find a normal for the surface of the ship that you want to land on the docking pad. You would then find a normal of the landing surface. In the parameter list shown below, the ship's surface normal would be ObjNormX#, ObjNormY#, ObjNormZ#. The landing pad's surface normal would be the SurfNormX#, SurfNormY#, SurfNormZ# parameters. Your ship would then rotate from its specified surface toward the landing surface by the angle specified in the final parameter.
SYNTAX
EZro_ObjRotateSurfToSurf ObjNo, ObjNormX#, ObjNormY#, ObjNormZ#, SurfNormX#, SurfNormY#, SurfNormZ#, angle#
"
You could only use this to point at another object if the other object also happened to be looking at the object you want to rotate...
If this is the purpose you want to use this command for then I would suggest there are many other better ways to achieve the same results. If this was just an example then it is not a very practical one.
In the interests of helping you understand the command better anyway I tried to whip up a short example for you but I got the following error for this command!?!?
"Could not understand command at line 70."
EZro_ObjRotateSurfToSurf 1, OX#,OY#,OZ#, nx#,ny#,nz#, 1
It highlights it anyway but then doesn't understand it...
Here is the full code I started but cannot test as it doesn't compile (so you too can sit and wonder...)
sync on
sync rate 60
autocam off
randomize timer()
position camera 10,10,10
point camera 0,3,0
`lander
make object cube 1, 1
color object 1, rgb(255,0,0)
`find three of the bottom faces on the cube and store their vertex numbers
null = make matrix4(100)
global v1 as integer
global v2 as integer
global v3 as integer
global vl as integer
find_vertices()
`dock
make object cube 2, 6
position object 2, 0,-3.5,0
`use EZro_FindNormal to get normal of the top surface
`here I am specifying three of the vertices of the top face
`of the dock manually but I suspect you will have a particular
`face in mind (without any code from you though I can't improve on this)
EZro_FindNormal -3,0,-3, -3,0,3, 3,0,3
nx# = EZro_GetNormalX()
ny# = EZro_GetNormalY()
nz# = EZro_GetNormalZ()
do
`set new lander position
if set=0
position object 1, rnd(20)-10,20,rnd(20)-10
rotate object 1, rnd(360),rnd(360),rnd(360)
set=1
endif
`move lander towards platform
x#=object position x(1)*.99
y#=object position y(1)*.99
z#=object position z(1)*.99
position object 1, x#,y#,z#
`rotate lander towards platform
`get the vertex positions for the bottom face on the cube
GetVertexPosition(1, 1, vl, v1)
x1#=(x vector3(1)-object position x(1))+object position x(1)
y1#=(y vector3(1)-object position y(1))+object position y(1)
z1#=(z vector3(1)-object position z(1))+object position z(1)
GetVertexPosition(1, 1, vl, v2)
x2#=(x vector3(1)-object position x(1))+object position x(1)
y2#=(y vector3(1)-object position y(1))+object position y(1)
z2#=(z vector3(1)-object position z(1))+object position z(1)
GetVertexPosition(1, 1, vl, v3)
x3#=(x vector3(1)-object position x(1))+object position x(1)
y3#=(y vector3(1)-object position y(1))+object position y(1)
z3#=(z vector3(1)-object position z(1))+object position z(1)
`get the normal for that face
EZro_FindNormal x1#,y1#,z1#, x2#,y2#,z2#, x3#,y3#,z3#
OX# = EZro_GetNormalX()
OY# = EZro_GetNormalY()
OZ# = EZro_GetNormalZ()
`rotate the lander towards the dock
EZro_ObjRotateSurfToSurf 1, OX#,OY#,OZ#, nx#,ny#,nz#, 1
sync
loop
function find_vertices()
p=1
limbcount=GET LIMB COUNT(p)
if limbcount>0
vcount=0
for n = 0 to 10
if limb exist(p,n)
LOCK VERTEXDATA FOR LIMB p,n,1
if limb exist(p,n)
vcount=vcount+get vertexdata vertex count()
if vcount>0 and limbcount=1 then MainLimb=n
endif
unlock vertexdata
endif
next n
endif
if vcount>0
`loop through limbs
for x = 0 to limbcount
LOCK VERTEXDATA FOR LIMB p,x
vmax=get vertexdata vertex count()
`loop through vertices
if vmax>0
for v=0 to vmax-1
` Place into vertex 1 the position of object p, limb x, vertex v
GetVertexPosition(1, p, x, v)
x#=(x vector3(1)-object position x(p))+object position x(p)
y#=(y vector3(1)-object position y(p))+object position y(p)
z#=(z vector3(1)-object position z(p))+object position z(p)
`this gives us the vector numbers on the cube
if x#=-.5 and y#=-.5 and z#=-.5 then v1=v : vl=x
if x#=.5 and y#=-.5 and z#=.5 then v2=v
if x#=-.5 and y#=-.5 and z#=.5 then v3=v
next v
endif
unlock vertexdata
next x
endif
endfunction
function GetVertexPosition(Vector as integer, CObject as integer, Limb as integer, Vertex as integer)
` Ensure that the target vector is a vector and the right size
null = delete vector3(Vector)
null = make vector3(Vector)
` Take the vertex position
lock vertexdata for limb CObject, Limb
set vector3 Vector, get vertexdata position x(Vertex), get vertexdata position y(Vertex), get vertexdata position z(Vertex)
unlock vertexdata
` Rotate by the limb direction (not its rotation - direction!)
` Magic number * 0.0174532925194 is used to convert degrees to radians
rotate x matrix4 100, limb direction x(CObject, Limb) * 0.0174532925194
transform coords vector3 Vector, Vector, 100
rotate y matrix4 100, limb direction y(CObject, Limb) * 0.0174532925194
transform coords vector3 Vector, Vector, 100
rotate z matrix4 100, limb direction z(CObject, Limb) * 0.0174532925194
transform coords vector3 Vector, Vector, 100
` Offset by limb position (not its offset - position!)
set vector3 Vector, limb position x(CObject, Limb) + x vector3(Vector), limb position y(CObject, Limb) + y vector3(Vector), limb position z(CObject, Limb) + z vector3(Vector)
endfunction
Hope it helps