Skip to content
This repository was archived by the owner on Sep 5, 2026. It is now read-only.

Look At [constraint]

Ercan Akyürek edited this page Feb 18, 2015 · 2 revisions

This constraint is perfect to look at another object. For example: If you want that one object looks at another object, you can use this constraint. In further updates, I will implement a full working camera object, which can perfectly look at an other object.

When I am speaking of object, I usually mean classes which inherits com.nolimitsframework.animation.Transition. So an object might be scenery object, a camera, a light, a sound source, a train or a car. But at this moment, only scenery objects are implemented yet (and experimental camera object).

So lets begin. You have two scenery objects. The first one is moving around, and the other one should look at that object.

Creating an animation for a random cube scenery object:

Animation Cube1 = new Animation("Scenery: Cube1");
Cube1.addAnimation(SceneryObject.PROPERTY_POSITION, new Vector3f(25.0f, 6.0f, 0.0f), 0.0f, 2.0f, Easing.ELASTIC_IN_OUT);
Cube1.start();

Adding the constraint to a random arrow scenery object:

SceneryObject Arrow = new SceneryObject("Arrow")
Arrow.attachConstraint(new LookAt(Cube1.getObject()));

Again, that's it.

Clone this wiki locally