displaying small trident at bottom right

Software: Away3D 4.x

pool338, Jr. Member
Posted: 17 July 2012 06:57 AM   Total Posts: 37

Hi again,

I need to place a small trident at the bottom right of my view, that doesn’t rotate around a big loaded model at the center.

My code till now is:

var trident:Trident = new Trident(100,true);
trident.500,
trident.500,
trident.0,

_view.scene.addChild(trident); 

The trident is placed as expected, but when i move the camera (which looks at a different model), the trident also moves.

   

Babylon, Jr. Member
Posted: 17 July 2012 08:25 AM   Total Posts: 39   [ # 1 ]

Greetings,
I know what you’re trying to do. I don’t know exaclty how to implement this but I do have an idea for you.
Rather than moving the camera, try moving the trident, then set the camera’s XYZ coordinates to the tridents, have the camera moveBackwards how ever many spaces and set it’s lookAtObject to the trident.

That might not work. What you need to do is set the tridents location based on the cameras, so anytime you move the camera you’ll have to move the trident as well. The problem is you need to know the tilt angle of the camera to place the trident correctly in it’s view. I don’t know how to do that exactly

 

   

Richard Olsson, Administrator
Posted: 17 July 2012 09:34 AM   Total Posts: 1192   [ # 2 ]

The simplest way would probably be to addChild() the trident to the camera, and addChild() the camera to the scene. The camera is just like any other 3D object, so can be used like this, which few people are aware of.

 

   

Babylon, Jr. Member
Posted: 17 July 2012 09:38 AM   Total Posts: 39   [ # 3 ]

Richard,
Thanks for the knowledge even though this isn’t my topic. That is pretty awesome.

 

   

pool338, Jr. Member
Posted: 17 July 2012 09:47 AM   Total Posts: 37   [ # 4 ]

@Richard: Just tried your idea. But I dont have a special camera object, I just used _view.camera. So I tried

trident.10,
trident.= -10,
trident.0,
_view.camera.addChild(trident);
_view.scene.addChild(_view.camera); 

But the result isn’t as expected. Look at the screenshot.

 

   

Richard Olsson, Administrator
Posted: 17 July 2012 09:50 AM   Total Posts: 1192   [ # 5 ]

The camera that is by default created in the View3D constructor is just like any other camera, so using it like this will work fine.

However, you cannot use the position that you’re trying to use, as that effectively places the trident to the left and below of the camera. You should give the trident a Z value of at least 100 or 1000 depending on the scale of your scene. That way it will actually be in front of the camera instead of just beside it.

 

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X