diff options
Diffstat (limited to 'indra/newview/llviewerobject.cpp')
-rw-r--r-- | indra/newview/llviewerobject.cpp | 55 |
1 files changed, 45 insertions, 10 deletions
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 03e524268d..80d645ca80 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -201,6 +201,10 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe mbCanSelect(TRUE), mFlags(0), mPhysicsShapeType(0), + mPhysicsGravity(0), + mPhysicsFriction(0), + mPhysicsDensity(0), + mPhysicsRestitution(0), mDrawable(), mCreateSelected(FALSE), mRenderMedia(FALSE), @@ -5022,6 +5026,10 @@ void LLViewerObject::updateFlags() gMessageSystem->addBOOL("CastsShadows", flagCastShadows() ); gMessageSystem->nextBlock("ExtraPhysics"); gMessageSystem->addU8("PhysicsShapeType", getPhysicsShapeType() ); + gMessageSystem->addF32("Density", getPhysicsDensity() ); + gMessageSystem->addF32("Friction", getPhysicsFriction() ); + gMessageSystem->addF32("Restitution", getPhysicsRestitution() ); + gMessageSystem->addF32("GravityMultiplier", getPhysicsGravity() ); gMessageSystem->sendReliable( regionp->getHost() ); if (getPhysicsShapeType() != 0) @@ -5062,7 +5070,26 @@ BOOL LLViewerObject::setFlags(U32 flags, BOOL state) void LLViewerObject::setPhysicsShapeType(U8 type) { mPhysicsShapeType = type; - updateFlags(); +} + +void LLViewerObject::setPhysicsGravity(F32 gravity) +{ + mPhysicsGravity = gravity; +} + +void LLViewerObject::setPhysicsFriction(F32 friction) +{ + mPhysicsFriction = friction; +} + +void LLViewerObject::setPhysicsDensity(F32 density) +{ + mPhysicsDensity = density; +} + +void LLViewerObject::setPhysicsRestitution(F32 restitution) +{ + mPhysicsRestitution = restitution; } void LLViewerObject::applyAngularVelocity(F32 dt) @@ -5303,13 +5330,13 @@ public: const LLSD& context, const LLSD& input) const { - LLSD objectData = input["body"]["ObjectData"]; - S32 numEntries = objectData.size(); + LLSD object_data = input["body"]["ObjectData"]; + S32 num_entries = object_data.size(); - for ( S32 i = 0; i < numEntries; i++ ) + for ( S32 i = 0; i < num_entries; i++ ) { - LLSD& currObjectData = objectData[i]; - U32 localID = currObjectData["LocalID"].asInteger(); + LLSD& curr_object_data = object_data[i]; + U32 local_id = curr_object_data["LocalID"].asInteger(); // Iterate through nodes at end, since it can be on both the regular AND hover list struct f : public LLSelectedNodeFunctor @@ -5320,16 +5347,24 @@ public: { return (node->getObject() && node->getObject()->mLocalID == mID ); } - } func(localID); + } func(local_id); LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstNode(&func); if (node) { // The LLSD message builder doesn't know how to handle U8, so we need to send as S8 and cast - U8 physicsShapeType = (U8)currObjectData["PhysicsShapeType"].asInteger(); - - node->getObject()->setPhysicsShapeType(physicsShapeType); + U8 type = (U8)curr_object_data["PhysicsShapeType"].asInteger(); + F32 density = (F32)curr_object_data["Density"].asReal(); + F32 friction = (F32)curr_object_data["Friction"].asReal(); + F32 restitution = (F32)curr_object_data["Restitution"].asReal(); + F32 gravity = (F32)curr_object_data["GravityMultiplier"].asReal(); + + node->getObject()->setPhysicsShapeType(type); + node->getObject()->setPhysicsGravity(gravity); + node->getObject()->setPhysicsFriction(friction); + node->getObject()->setPhysicsDensity(density); + node->getObject()->setPhysicsRestitution(restitution); } } |