mirror of https://github.com/axmolengine/axmol.git
Merge pull request #882 from aismann/dev
Adapt Physics3DTest.cpp to #879
This commit is contained in:
commit
faa6962ce6
|
@ -286,7 +286,7 @@ std::string Physics3DConstraintDemo::subtitle() const
|
||||||
|
|
||||||
std::string Physics3DKinematicDemo::subtitle() const
|
std::string Physics3DKinematicDemo::subtitle() const
|
||||||
{
|
{
|
||||||
return "Physics3D Kinematic";
|
return "Physics3D Kinematic + #879";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Physics3DKinematicDemo::init()
|
bool Physics3DKinematicDemo::init()
|
||||||
|
@ -309,6 +309,32 @@ bool Physics3DKinematicDemo::init()
|
||||||
// static object sync is not needed
|
// static object sync is not needed
|
||||||
floor->setSyncFlag(Physics3DComponent::PhysicsSyncFlag::NONE);
|
floor->setSyncFlag(Physics3DComponent::PhysicsSyncFlag::NONE);
|
||||||
|
|
||||||
|
// Issue #879 STARTS BELOW
|
||||||
|
{
|
||||||
|
Physics3DRigidBodyDes rbDes;
|
||||||
|
std::string tree1 = "MeshRendererTest/tree-model/tree1.obj";
|
||||||
|
|
||||||
|
float scale = 12.0f;
|
||||||
|
std::vector<Vec3> trianglesList = Bundle3D::getTrianglesList(tree1);
|
||||||
|
for (auto& it : trianglesList)
|
||||||
|
{
|
||||||
|
it *= scale;
|
||||||
|
}
|
||||||
|
|
||||||
|
rbDes.mass = 0.0f;
|
||||||
|
rbDes.shape = Physics3DShape::createMesh(&trianglesList[0], (int)trianglesList.size() / 3);
|
||||||
|
auto rigidBody = Physics3DRigidBody::create(&rbDes);
|
||||||
|
auto component = Physics3DComponent::create(rigidBody);
|
||||||
|
auto sprite = Sprite3D::create(tree1);
|
||||||
|
sprite->addComponent(component);
|
||||||
|
sprite->setPosition3D(Vec3(20.0f, 0.0f, 0.0f));
|
||||||
|
sprite->setScale(scale);
|
||||||
|
sprite->setCameraMask((unsigned short)CameraFlag::USER1);
|
||||||
|
this->addChild(sprite);
|
||||||
|
}
|
||||||
|
// Issue #879 ENDS HERE
|
||||||
|
|
||||||
|
|
||||||
// create Kinematics
|
// create Kinematics
|
||||||
for (unsigned int i = 0; i < 3; ++i)
|
for (unsigned int i = 0; i < 3; ++i)
|
||||||
{
|
{
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 537 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.3 MiB |
|
@ -0,0 +1,28 @@
|
||||||
|
# Blender 3.3.0 MTL File: 'lowpoly_tree_SketchFab.blend.blend'
|
||||||
|
# www.blender.org
|
||||||
|
|
||||||
|
newmtl Branches0025_1_S
|
||||||
|
Ns 250.000000
|
||||||
|
Ka 1.000000 1.000000 1.000000
|
||||||
|
Kd 0.800000 0.800000 0.800000
|
||||||
|
Ks 0.500000 0.500000 0.500000
|
||||||
|
Ke 0.000000 0.000000 0.000000
|
||||||
|
Ni 1.000000
|
||||||
|
d 0.500000
|
||||||
|
Tr 0.5
|
||||||
|
illum 6
|
||||||
|
map_Kd Branches0025_1_S.png
|
||||||
|
map_d Branches0025_1_S.png
|
||||||
|
|
||||||
|
newmtl bark.001
|
||||||
|
Ns 250.000000
|
||||||
|
Ka 1.000000 1.000000 1.000000
|
||||||
|
Kd 0.800000 0.800000 0.800000
|
||||||
|
Ks 0.132911 0.132911 0.132911
|
||||||
|
Ke 0.000000 0.000000 0.000000
|
||||||
|
Ni 1.000000
|
||||||
|
d 0.500000
|
||||||
|
Tr 0.5
|
||||||
|
illum 6
|
||||||
|
map_Kd baketree.png
|
||||||
|
map_d baketree.png
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue