Added add force API endpoint

This commit is contained in:
Antoine Pilote
2023-07-18 00:16:26 -04:00
parent 6c15fe9e85
commit 1fee5b8d41
7 changed files with 63 additions and 8 deletions

View File

@@ -24,6 +24,8 @@ class Scene {
return Light.new(id)
} else if (component == "CharacterController") {
return CharacterController.new(id)
} else if (component == "RigidBody") {
return RigidBody.new(id)
} else if (component == "Camera") {
return Camera.new(id)
} else if (component == "Transform") {
@@ -70,6 +72,9 @@ class Scene {
foreign static IsCharacterControllerOnGround_(e)
//foreign static IsOnGround_(e)
// RigidBody
foreign static AddForce_(e, x, y, z)
foreign static TriggerGetOverlappingBodyCount_(e)
foreign static TriggerGetOverlappingBodies_(e)
@@ -159,6 +164,16 @@ class CharacterController {
}
}
class RigidBody {
construct new(id) {
_entityId = id
}
AddForce(force) {
Scene.AddForce_(_entityId, force.x, force,y, force.z)
}
}
class Camera {
construct new(id) {
_entityId = id