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 XXSharpKmyPhysics
12{
13 ref class RigidBody;
14 ref class Collider;
15
16 private ref class PhysicsObject
17 {
18 kmyPhysics::PhysicsObject* obj = nullptr;
19 bool ownptr = false;
20
21 public:
22 PhysicsObject();
23 PhysicsObject(kmyPhysics::PhysicsObject* o);
24 ~PhysicsObject();
25 void clearPhysics() {
26 if (obj)obj->clearPhysics();
27 }
28 void setFellowId(int id) {
29 if (obj)obj->setFellowId(id);
30 }
31
32 void setLocalMatrix(XXSharpKmyMath::Matrix4 mtx);
33 void setLocalMatrixWithoutScale(XXSharpKmyMath::Matrix4 mtx);
34 void setTranslate(XXSharpKmyMath::Vector3 trans);
35 void setRotate(XXSharpKmyMath::Quat q);
36 void setScale(XXSharpKmyMath::Vector3 scale);
37
38 void setRigidBody(XXSharpKmyPhysics::RigidBody^ rb, XXSharpKmyMath::Matrix4 offset);
39 void addRigidBody(XXSharpKmyPhysics::RigidBody^ rb, System::String ^nodename, XXSharpKmyMath::Matrix4 offset, System::String^ objname, bool controlRigidBody);
40 void addCollider(XXSharpKmyPhysics::Collider^ cd, System::String ^nodename, XXSharpKmyMath::Matrix4 offset, System::String^ objname);
41 void addSixDofConstraint(System::String^ nameA, System::String^ nameB,
42 XXSharpKmyMath::Vector3 worldPivot,
43 XXSharpKmyMath::Vector3 lowerSlideLimit,
44 XXSharpKmyMath::Vector3 upperSlideLimit,
45 XXSharpKmyMath::Vector3 lowerAngularLimit,
46 XXSharpKmyMath::Vector3 upperAngularLimit,
47 array<bool> ^spring,
48 array<float> ^stiffnes,
49 array<float> ^damping);
50 void resetRigidBodyPosition();
51
52 XXSharpKmyMath::Matrix4 getNodeWorldMatrix(System::String^ name);
53 XXSharpKmyPhysics::RigidBody^ getRigidBody(System::String^ name);
54 XXSharpKmyPhysics::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();
60 XXSharpKmyMath::Matrix4 getWorldMatrix();
61
62 void enable();
63 void disable();
64 void activate();
65 bool isEnableSelf();
66 bool isEnableInHierarchy();
67
68 static void addInactiveDisplayID(u32 id);
69 static void removeInactiveDisplayID(u32 id);
70 static void clearInactiveDisplayID();
71 };
72}
73
Definition: PhysicsNode.h:7