Some questionable changes
This commit is contained in:
@@ -164,9 +164,9 @@ function(blender_import_vrm BLEND VRM EDITABLE RIG)
|
||||
COMMAND ${BLENDER} -b -Y -P ${CMAKE_SOURCE_DIR}/assets/blender/scripts/import_vrm2.py -- ${VRM_NAME}.vrm ${BLEND} ${EDITABLE} ${RIG}
|
||||
COMMAND ${CMAKE_COMMAND} -D FILE=${BLEND} -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/check_file_size.cmake
|
||||
COMMAND ${CMAKE_COMMAND} -E touch_nocreate ${BLEND}
|
||||
DEPENDS ${CMAKE_SOURCE_DIR}/assets/blender/scripts/import_vrm2.py
|
||||
DEPENDS ${CMAKE_SOURCE_DIR}/assets/blender/scripts/import_vrm2.py
|
||||
${CMAKE_CURRENT_BINARY_DIR}/blender-addons-installed
|
||||
${VRM}
|
||||
${VRM} ${CMAKE_BINARY_DIR}/assets/blender/mixamo
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
)
|
||||
endfunction()
|
||||
|
||||
@@ -446,6 +446,10 @@ Ogre::Vector3 convert(const JPH::Vec3Arg &vec)
|
||||
{
|
||||
return { vec[0], vec[1], vec[2] };
|
||||
}
|
||||
Ogre::Vector3 convert(const JPH::RVec3Arg &vec)
|
||||
{
|
||||
return { (float)vec[0], (float)vec[1], (float)vec[2] };
|
||||
}
|
||||
JPH::RVec3 convert(const Ogre::Vector3 &vec)
|
||||
{
|
||||
return { vec.x, vec.y, vec.z };
|
||||
@@ -785,8 +789,13 @@ public:
|
||||
node->_setDerivedOrientation(JoltPhysics::convert(q));
|
||||
}
|
||||
for (JPH::Character *ch : characters) {
|
||||
if (body_interface.IsAdded(ch->GetBodyID()))
|
||||
if (body_interface.IsAdded(ch->GetBodyID())) {
|
||||
ch->PostSimulation(0.1f);
|
||||
Ogre::SceneNode *node = id2node[ch->GetBodyID()];
|
||||
if (node)
|
||||
node->_setDerivedPosition(
|
||||
JoltPhysics::convert(ch->GetPosition()));
|
||||
}
|
||||
}
|
||||
|
||||
if (debugDraw)
|
||||
@@ -1002,6 +1011,26 @@ public:
|
||||
characters.insert(ch);
|
||||
return ch;
|
||||
}
|
||||
JPH::CharacterBase *createCharacter(Ogre::SceneNode *node,
|
||||
JPH::ShapeRefC shape)
|
||||
{
|
||||
JPH::CharacterSettings settings;
|
||||
settings.mLayer = Layers::MOVING;
|
||||
settings.mShape = shape;
|
||||
settings.mSupportingVolume =
|
||||
JPH::Plane(JPH::Vec3::sAxisY(), -0.2f);
|
||||
JPH::Character *ch = new JPH::Character(
|
||||
&settings,
|
||||
JoltPhysics::convert(node->_getDerivedPosition()),
|
||||
JoltPhysics::convert(node->_getDerivedOrientation()), 0,
|
||||
&physics_system);
|
||||
JPH::BodyID id = ch->GetBodyID();
|
||||
id2node[id] = node;
|
||||
node2id[node] = id;
|
||||
characterBodies.insert(id);
|
||||
characters.insert(ch);
|
||||
return ch;
|
||||
}
|
||||
JPH::ShapeRefC createBoxShape(Ogre::Vector3 extents)
|
||||
{
|
||||
JPH::Vec3 h(extents.x, extents.y, extents.z);
|
||||
@@ -1694,6 +1723,11 @@ JPH::CharacterBase *JoltPhysicsWrapper::createCharacter(Ogre::SceneNode *node,
|
||||
{
|
||||
return phys->createCharacter(node, characterHeight, characterRadius);
|
||||
}
|
||||
JPH::CharacterBase *JoltPhysicsWrapper::createCharacter(Ogre::SceneNode *node,
|
||||
JPH::ShapeRefC shape)
|
||||
{
|
||||
return phys->createCharacter(node, shape);
|
||||
}
|
||||
void JoltPhysicsWrapper::addShapeToCompound(JPH::Ref<JPH::Shape> compoundShape,
|
||||
JPH::ShapeRefC childShape,
|
||||
const Ogre::Vector3 &position,
|
||||
|
||||
@@ -54,6 +54,8 @@ template<class T> T convert(const Ogre::Vector3 &vec)
|
||||
{
|
||||
return { vec.x, vec.y, vec.z };
|
||||
}
|
||||
Ogre::Vector3 convert(const JPH::RVec3Arg &vec);
|
||||
JPH::RVec3 convert(const Ogre::Vector3 &vec);
|
||||
Ogre::Quaternion convert(const JPH::QuatArg &rot);
|
||||
JPH::Quat convert(const Ogre::Quaternion &rot);
|
||||
struct ShapeData;
|
||||
@@ -166,6 +168,8 @@ public:
|
||||
JPH::CharacterBase *createCharacter(Ogre::SceneNode *node,
|
||||
float characterHeight,
|
||||
float characterRadius);
|
||||
JPH::CharacterBase *createCharacter(Ogre::SceneNode *node,
|
||||
JPH::ShapeRefC shape);
|
||||
void addShapeToCompound(JPH::Ref<JPH::Shape> compoundShape,
|
||||
JPH::ShapeRefC childShape,
|
||||
const Ogre::Vector3 &position,
|
||||
|
||||
Reference in New Issue
Block a user