public class BodyModel extends TraitModel implements Body
The ObjectGame
owner must have the following Trait
:
GRAVITY_EARTH, GRAVITY_MARS, GRAVITY_MOON
Constructor and Description |
---|
BodyModel()
Create a body model.
|
Modifier and Type | Method and Description |
---|---|
double |
getMass()
Get body mass.
|
double |
getWeight()
Get body weight (mass * gravity).
|
void |
prepare(ObjectGame owner,
Services services)
Prepare the trait.
|
void |
resetGravity()
Reset current gravity force (usually when hit the ground).
|
void |
setDesiredFps(int desiredFps)
Set the desired fps.
|
void |
setGravity(double gravity)
Set the gravity to use.
|
void |
setGravityMax(double max)
Set the maximum gravity value.
|
void |
setMass(double mass)
Set body mass.
|
void |
setVectors(Direction... vectors)
Set forces involved in gravity and movement.
|
void |
update(double extrp) |
getOwner
public void prepare(ObjectGame owner, Services services)
Trait
prepare
in interface Trait
prepare
in class TraitModel
owner
- The owner reference.services
- The services reference.public void resetGravity()
Body
resetGravity
in interface Body
public void setVectors(Direction... vectors)
Body
setVectors
in interface Body
vectors
- The vectors list.public void setDesiredFps(int desiredFps)
Body
setDesiredFps
in interface Body
desiredFps
- The desired fps.public void setGravity(double gravity)
Body
Body.GRAVITY_EARTH
is used by default.setGravity
in interface Body
gravity
- The gravity to use (in m/s²).public void setGravityMax(double max)
Body
setGravityMax
in interface Body
max
- The maximum gravity value.public void setMass(double mass)
Body
public double getMass()
Body
Copyright © 2016 Byron 3D Games Studio. All rights reserved.