Ask a Question related to Macromedia Director 3D, Design and Development.
-
Mazuho #1
Contrain PointAt to z-axis of object
I'm trying to use the point at method but I only want the model to point at the target with one axis. How can I do this?
Thanks.
Mazuho Guest
-
Record simple rotate of object on Z axis
Hi, Using CS4. Is it possible to automatically record an object turning 360 on the Z axis? At the moment, I am turning the object a couple of... -
null object returnd to .net client while calling axis web service
Hi , I have a java web services (message style web service whichreturns document object) on axis and im trying to access it fromvb.net client. It is... -
.net recieving null object while accessing axis message style web service
Hi, Recieving null object when message style web service isaccessed from vb.net client. SOAP messages are fine. My webservice uses the method... -
How to turn a 3d object around its axis?
Hello! Im a relatively new user of Director and need some help. Does anyone have a script that makes it possible to zoom in/out of a 3D-object and... -
Why is my axis point not moving with my object?
In CS I have had trouble when I drag a vector object, the axis (center point) does not follow along when I drag the image. Then when I go to scale... -
Mazuho #2
Re: Contrain PointAt to z-axis of object
I solved it partly, by setting the .x and .y parameters of
object.transform.rotation to 0.
But it still doesn't work just right... When I drive past the object it gets
rotated 180 degrees in z, resulting in the back pointing at the target instead
of the front.
Anyone experienced the same?
Mazuho Guest
-
openspark #3
Re: Contrain PointAt to z-axis of object
Have you looked at the pointAtOrientation property of 3D objects?
Alternatively you can do some 3D mathematics, and rotate the model by hand.
To rotate your model, you can use the syntax:
??myModel.rotate(vPosition, vAxis, vAngle, #world)
You'll need to work out vAxis and vAngle from the current orientation of the
model:
vPosition = myModel.worldPosition
vZAxis = myModel.getWorldTransform().zAxis -- current
vPointToPointAt = <some vector>
vDirection - vPointToPointAt - vPosition -- desired
vAxis = vZAxis.cross(vDirection)
vAngle = angleBetween(vZAxis, vDirection)
If vAxis has a magnitude of 0, but vAngle is not 0, then your model is
pointing in diametrically the opposite direction: vAngle will be 180. Rotating
your model about any axis of rotation will make it point in the right
direction, but it will probably be tilted or upside down. You will need to
choose your rotatition vector with care to make sure that your model ends up
the right way up.
openspark Guest
-
nick kang #4
Re: Contrain PointAt to z-axis of object
I usually use a utility node (in this case, a SW3D group) for something like
this:
-- limit pointAt() to y-axis rotation
-- assumptions:
-- +y is Up
-- pointAt() orients nodes along local negative z-axis
gUtilGroup.transform.position = pEntityModel.transform.position
gUtilGroup.transform.position.y = pTargetPosition.y
gUtilGroup.pointAt(pTargetPosition, gUp)
pEntityModel.transform.rotation = gUtilGroup.transform.rotation
-- global dependencies (need to be defined during scene setup):
gUtilGroup = gSW3D.newGroup("UtilGroup")
gUp = vector(0,1,0)
Another thing to watch out for, pointAt() will generate an "Invalid Point"
error if the node's position coincides with the target position.
-nick
nick kang Guest
-
Mazuho #5
Re: Contrain PointAt to z-axis of object
Thank you guys, you really helped me out.
Mazuho Guest



Reply With Quote

