Logo
PhysicsObject.h
1#pragma once
2
3#include "Math/Matrix4.h"
4#include "math/Vector3.h"
5#include "math/Quat.h"
6
7namespace kmyPhysics {
8 class PhysicsObject;
9}
10
11namespace SharpKmyPhysics
12{
13 ref class RigidBody;
14 ref class Collider;
15
16 public ref class PhysicsObject
17 {
18 kmyPhysics::PhysicsObject* obj = nullptr;
19 bool ownptr = false;
20
21 public:
23 PhysicsObject(kmyPhysics::PhysicsObject* o);
25 void clearPhysics() {
26 if (obj)obj->clearPhysics();
27 }
28 void setFellowId(int id) {
29 if (obj)obj->setFellowId(id);
30 }
31
37
39 void addRigidBody(SharpKmyPhysics::RigidBody^ rb, System::String^ nodename, SharpKmyMath::Matrix4 offset, System::String^ objname, bool controlRigidBody);
40 void addCollider(SharpKmyPhysics::Collider^ cd, System::String^ nodename, SharpKmyMath::Matrix4 offset, System::String^ objname);
41 void addSixDofConstraint(System::String^ nameA, System::String^ nameB,
42 SharpKmyMath::Vector3 worldPivot,
43 SharpKmyMath::Vector3 lowerSlideLimit,
44 SharpKmyMath::Vector3 upperSlideLimit,
45 SharpKmyMath::Vector3 lowerAngularLimit,
46 SharpKmyMath::Vector3 upperAngularLimit,
47 array<bool>^ spring,
48 array<float>^ stiffnes,
49 array<float>^ damping);
51
52 SharpKmyMath::Matrix4 getNodeWorldMatrix(System::String^ name);
53 SharpKmyPhysics::RigidBody^ getRigidBody(System::String^ name);
54 SharpKmyPhysics::Collider^ getCollider(System::String^ name);
55
56 void setDisplayID(u32 displayID) { if (obj)obj->setDisplayID(displayID); }
57 u32 getDisplayID() { return obj ? obj->getDisplayID() : 0; }
58 void setParent(PhysicsObject^ parent, System::String^ nodename);
59 void updateMatrix();
61
62 void enable();
63 void disable();
64 void activate();
65 bool isEnableSelf();
67 };
68}
69
Definition: Matrix4.h:12
Definition: Collider.h:8
Definition: PhysicsObject.h:17
void setParent(PhysicsObject^ parent, System::String^ nodename)
Definition: PhysicsObject.cpp:177
void setRigidBody(SharpKmyPhysics::RigidBody^ rb, SharpKmyMath::Matrix4 offset)
Definition: PhysicsObject.cpp:30
void resetRigidBodyPosition()
Definition: PhysicsObject.cpp:124
kmyPhysics::PhysicsObject * obj
Definition: PhysicsObject.h:18
void addRigidBody(SharpKmyPhysics::RigidBody^ rb, System::String^ nodename, SharpKmyMath::Matrix4 offset, System::String^ objname, bool controlRigidBody)
Definition: PhysicsObject.cpp:41
SharpKmyMath::Matrix4 getNodeWorldMatrix(System::String^ name)
Definition: PhysicsObject.cpp:133
~PhysicsObject()
Definition: PhysicsObject.cpp:20
void setLocalMatrixWithoutScale(SharpKmyMath::Matrix4 mtx)
Definition: PhysicsObject.cpp:213
void disable()
Definition: PhysicsObject.cpp:264
u32 getDisplayID()
Definition: PhysicsObject.h:57
void setTranslate(SharpKmyMath::Vector3 trans)
Definition: PhysicsObject.cpp:192
void enable()
Definition: PhysicsObject.cpp:257
bool isEnableInHierarchy()
Definition: PhysicsObject.cpp:281
void setFellowId(int id)
Definition: PhysicsObject.h:28
bool isEnableSelf()
Definition: PhysicsObject.cpp:271
void clearPhysics()
Definition: PhysicsObject.h:25
void addSixDofConstraint(System::String^ nameA, System::String^ nameB, SharpKmyMath::Vector3 worldPivot, SharpKmyMath::Vector3 lowerSlideLimit, SharpKmyMath::Vector3 upperSlideLimit, SharpKmyMath::Vector3 lowerAngularLimit, SharpKmyMath::Vector3 upperAngularLimit, array< bool >^ spring, array< float >^ stiffnes, array< float >^ damping)
Definition: PhysicsObject.cpp:65
SharpKmyPhysics::Collider getCollider(System::String^ name)
Definition: PhysicsObject.cpp:157
void addCollider(SharpKmyPhysics::Collider^ cd, System::String^ nodename, SharpKmyMath::Matrix4 offset, System::String^ objname)
Definition: PhysicsObject.cpp:53
void setDisplayID(u32 displayID)
Definition: PhysicsObject.h:56
SharpKmyPhysics::RigidBody getRigidBody(System::String^ name)
Definition: PhysicsObject.cpp:146
bool ownptr
Definition: PhysicsObject.h:19
PhysicsObject()
Definition: PhysicsObject.cpp:5
void setLocalMatrix(SharpKmyMath::Matrix4 mtx)
Definition: PhysicsObject.cpp:229
void setScale(SharpKmyMath::Vector3 scale)
Definition: PhysicsObject.cpp:206
void updateMatrix()
Definition: PhysicsObject.cpp:186
void activate()
Definition: PhysicsObject.cpp:169
SharpKmyMath::Matrix4 getWorldMatrix()
Definition: PhysicsObject.cpp:246
void setRotate(SharpKmyMath::Quat q)
Definition: PhysicsObject.cpp:199
Definition: RigidBody.h:9
Definition: Billboard.h:6
Definition: PhysicsNode.h:7
Definition: Quat.h:5
Definition: Vector3.h:7