-
Notifications
You must be signed in to change notification settings - Fork 5
Looking
Oğuz Eroğlu edited this page Jun 11, 2020
·
3 revisions
Every Kompute entity has a lookDirection
property representing the direction it's looking towards. The initial value of lookDirection
is Vector3D(0, 0, -1)
. Note that this value should not be modified by the user.
Entity#setLookTarget
API may be used in order to make an Entity look at a target position. In order to achieve realism, this API considers lookSpeed
property of the entity in order to gradually look at the target, rather than directly looking at there (turning its head towards the target). Default value of lookSpeed
is 0.1
.
// create an Entity or a Steerable
var entity = new Kompute.Entity("entity1", new Kompute.Vector3D(), new Kompute.Vector3D(10, 20, 30));
// modify it's look speed
entity.lookSpeed = 0.5;
// create a target
var target = new Kompute.Vector3D(100, 0, 0);
// look at target gradually
entity.setLookTarget(target);
// update the entity
entity.update();
// lookDirection is now updated. Greater the lookSpeed, faster the entity will look at the target position.
console.log(entity.lookDirection);
LookWhereYouAreGoingBehavior may be used to make an entity automatically face towards to the direction it's moving.
- Core
- Path
-
Steering Behaviors
- AlignBehavior
- ArriveBehavior
- AvoidBehavior
- BlendedSteeringBehavior
- CohesionBehavior
- EvadeBehavior
- FleeBehavior
- HideBehavior
- JumpBehavior
- LookWhereYouAreGoingBehavior
- PathFollowingBehavior
- PrioritySteeringBehavior
- PursueBehavior
- RandomPathBehavior
- RandomWaypointBehavior
- SeekBehavior
- SeparationBehavior
- Wander2DBehavior
- Wander3DBehavior
- Math
- Extra