I have a somewhat complicated method for achieving this, but it works flawlessly. It takes 4 points around the object and finds the distance from each of those four points to the point in space you want the object to face.
`Assume that the object number is Obj#
`First You have to find the XYZ positons of each point.
`You could use the NewX/NewY/NewZ functions, but they are tough to get to work
`position of the object
x#=object position x(obj#)
y#=object position y(obj#)
z#=object position z(obj#)
`position to the left of the object
turn object left obj#,90
move object obj#,5
leftx#=object position x(obj#)
lefty#=object position y(obj#)
leftz#=object position z(obj#)
`position to the right of the object
turn object right obj#,180
move object obj#,10
rightx#=object position x(obj#)
righty#=object position y(obj#)
rightz#=object position z(obj#)
`position above the object
move object obj#,-5
turn object left obj#,90
pitch object up obj#,90
move object obj#,5
topx=#object position x(obj#)
topy=#object position y(obj#)
topz=#object position z(obj#)
`position below the object
pitch object down obj#,180
move object obj#,10
bottomx#=object position x(obj#)
bottomy#=object position y(obj#)
bottomz#=object position z(obj#)
`Reset the position and angle
move object obj#,-5
pitch object up obj#,5
`Now that we have the 5 positions, we need to find the distance between the point and each
`Lets assume the point's position is at px#,py#,pz#
`The distance formula is Sqrt((x1-x2)^2+(y1-y2)^2+(z1-z2)^2)
If Sqrt((leftx#-px#)^2+(lefty#-py#)^2+(leftz#-pz#)^2) < Sqrt((rightx#-px#)^2+(righty#-py#)^2+(rightz#-pz#)^2)
Turn Object Left Obj#,[TurnAmount]
Else
Turn Object Right Obj#,[TurnAmount]
Endif
If Sqrt((topx#-px#)^2+(topy#-py#)^2+(topz#-pz#)^2) < Sqrt((bottomx#-px#)^2+(bottomy#-py#)^2+(bottomz#-pz#)^2)
Pitch Object Up Obj#,[TurnAmount]
Else
Pitch Object Down Obj#,[TurnAmount]
Endif
Yes... as I said before it is complicated. But it works. BatVink may have a better meathod though... lol... Anyways, I hope I helped...
The computer isn't an addiction; it's more of a mental and social dependency.