57 #ifndef __I6ENGINE_API_PHYSICALSTATECOMPONENT_H__
58 #define __I6ENGINE_API_PHYSICALSTATECOMPONENT_H__
65 #include "boost/thread/mutex.hpp"
115 CollisionGroup(uint32_t response, uint32_t type, uint32_t mask) : responseType(response), crashType(type), crashMask(mask) {
122 explicit CollisionGroup(
const std::string & str) : responseType(), crashType(), crashMask() {
123 std::stringstream ss(str);
137 std::stringstream ss;
138 ss << responseType <<
" " << crashType <<
" " <<
crashMask;
139 params.insert(std::make_pair(entry, ss.str()));
142 template<
class Archive>
236 Vec3 getPosition()
const;
247 void setPosition(
const Vec3 & position, uint32_t prio);
263 void setRotation(
const Quaternion & rotation, uint32_t prio);
275 void setScale(
const Vec3 & scale, uint32_t prio);
296 void setCollisionShape(ShapeType st,
const attributeMap & params);
301 void applyRotation(
const Quaternion & rotation);
307 if (_speedDirty > 0) {
310 return _linearVelocity;
320 void setLinearVelocity(
const Vec3 & linVel, uint32_t prio);
326 void applyCentralForce(
const Vec3 & cForce,
bool forceIsLocalSpace);
327 void applyForce(
const Vec3 & force,
const Vec3 & offset,
bool forceIsLocalSpace);
337 void setGravity(
const Vec3 & gravity);
352 void rayTest(
const Vec3 & from,
const Vec3 & to, RayTestRepetition rtr, RayTestNotify rtn,
const GameMessage::Ptr & msg);
355 return "PhysicalState";
361 void addPosition(
const Vec3 & pos);
363 std::vector<componentOptions> getComponentOptions()
override;
373 uint32_t _speedDirty;
386 uint32_t _scaleDirty;
391 Vec3 _linearVelocity;
399 std::vector<std::tuple<Vec3, Vec3, bool>> _forces;
414 ShapeType _shapeType;
435 mutable boost::mutex _lock;
443 void Init()
override;
445 void Finalize()
override;
455 void Tick()
override;
457 virtual std::pair<AddStrategy, int64_t> howToAdd(
const ComPtr & comp)
const override;
CollisionGroup getCollisionFlags() const
returns a reference to the Collision Flags of this GameObject
Class describing a 3d rotation.
void serialize(Archive &ar, const unsigned int)
Vec3 getScale() const
returns the current scale value
#define ISIXE_MODULES_API
Quaternion getRotation() const
Returns the rotation of the object.
ShapeType
Different shape types supported by i6engine.
CollisionGroup(uint32_t response, uint32_t type, uint32_t mask)
Constructor. Initializes members with given values.
boost::shared_ptr< Message > Ptr
std::map< std::string, std::string > attributeMap
uint32_t crashMask
mask of all objects the given object gets collision feedback
ShatterInterest
Different flags for collision interest.
std::string getTemplateName() const override
returns the name this template was registered with
Implements 3-dimensional vectors.
Vec3 getLinearVelocity() const
returns linear velocity
A shared pointer counting references and adds objects being not referenced any more to an internal li...
void insertInMap(const std::string &entry, attributeMap ¶ms) const
struct containing information from raytest objID: id of GO hit first by the ray sourceID: id of the s...
struct containing the collision info for an object
struct i6e::api::RayTestResult RayTestResult
struct containing information from raytest objID: id of GO hit first by the ray sourceID: id of the s...
Represents an object's physical state and synchronizes with the Physics subsystem. For creating a PhysicalStateComponent, these keys are possible: Name Required Type Description Public syncPrio no int priority from which upwards updates should be sent through network yes gravity no Vec3 gravity for this object. Replaces default yes pos yes Vec3 position of the SceneNode yes rot yes Quaternion rotation of the SceneNode yes scale yes Vec3 scale of the SceneNode yes collisionGroup yes int int int ResponseType CrashType CrashMask yes shapeType yes int one of the shapeTypes from ShapeType enum yes shatterInterest yes int one of the shatterInterests from ShatterInterest enum yes compound yes bool should this PSC be used as a compound shape together with other ones of this GameObject yes
CollisionGroup & operator=(const CollisionGroup &cg)
CollisionGroup(const std::string &str)
Constructor. Initializes members with given values.
RayTestNotify
Different flags for the kind of notify mechanism of raytest.
uint32_t crashType
type of the object
Component Base Class. All Components must derive from Component.
RayTestRepetition
Different flags for kind of raytest repetition.
uint32_t responseType
defines the physical properties
CollisionGroup()
Constructor. Initializes members with 0 (no Collisions)