use of org.terasology.math.geom.Vector3f in project Terasology by MovingBlocks.
the class Location method removeChild.
public static void removeChild(EntityRef parent, EntityRef child) {
LocationComponent childLoc = child.getComponent(LocationComponent.class);
LocationComponent parentLoc = parent.getComponent(LocationComponent.class);
if (childLoc != null && parentLoc != null && childLoc.getParent().equals(parent)) {
Vector3f oldWorldPos = childLoc.getWorldPosition();
parentLoc.children.remove(child);
childLoc.parent = EntityRef.NULL;
childLoc.setWorldPosition(oldWorldPos);
child.saveComponent(childLoc);
parent.saveComponent(parentLoc);
}
}
use of org.terasology.math.geom.Vector3f in project Terasology by MovingBlocks.
the class LocationComponent method getWorldDirection.
public Vector3f getWorldDirection() {
Vector3f result = Direction.FORWARD.getVector3f();
getWorldRotation().rotate(result, result);
return result;
}
use of org.terasology.math.geom.Vector3f in project Terasology by MovingBlocks.
the class LocationComponent method getLocalDirection.
public Vector3f getLocalDirection() {
Vector3f result = Direction.FORWARD.getVector3f();
getLocalRotation().rotate(result, result);
return result;
}
use of org.terasology.math.geom.Vector3f in project Terasology by MovingBlocks.
the class FirstPersonClientSystem method setFirstPersonheldItemMountPointRotation.
@Command(shortDescription = "Sets the held item mount point rotation for the first person view")
public void setFirstPersonheldItemMountPointRotation(@CommandParam("x") float x, @CommandParam("y") float y, @CommandParam("z") float z) {
FirstPersonHeldItemMountPointComponent newComponent = localPlayer.getCameraEntity().getComponent(FirstPersonHeldItemMountPointComponent.class);
if (newComponent != null) {
newComponent.rotateDegrees = new Vector3f(x, y, z);
ensureClientSideEntityOnHeldItemMountPoint(OnActivatedComponent.newInstance(), localPlayer.getCameraEntity(), newComponent);
}
}
use of org.terasology.math.geom.Vector3f in project Terasology by MovingBlocks.
the class FirstPersonClientSystem method setFirstPersonheldItemMountPointTranslation.
@Command(shortDescription = "Sets the held item mount point translation for the first person view")
public void setFirstPersonheldItemMountPointTranslation(@CommandParam("x") float x, @CommandParam("y") float y, @CommandParam("z") float z) {
FirstPersonHeldItemMountPointComponent newComponent = localPlayer.getCameraEntity().getComponent(FirstPersonHeldItemMountPointComponent.class);
if (newComponent != null) {
newComponent.translate = new Vector3f(x, y, z);
ensureClientSideEntityOnHeldItemMountPoint(OnActivatedComponent.newInstance(), localPlayer.getCameraEntity(), newComponent);
}
}
Aggregations