|
RigsofRods
Soft-body Physics Simulation
|
Go to the documentation of this file.
102 void RepairActor(
Collisions* collisions,
const Ogre::String& inst,
const Ogre::String& box,
bool keepPosition =
false);
float GetSimulationSpeed() const
int CheckNetworkStreamsOk(int sourceid)
unsigned long GetNetTime()
bool SaveScene(Ogre::String filename)
int GetNetTimeOffset(int sourceid)
static const ActorPtr ACTORPTR_NULL
RoR::CmdKeyInertiaConfig m_inertia_config
void AddFreeForce(FreeForceRequest *rq)
std::map< beam_t *, std::pair< ActorPtr, ActorPtr > > inter_actor_links
bool AreTrucksForcedAwake() const
void RemoveStreamSource(int sourceid)
ActorPtr FindActorInsideBox(Collisions *collisions, const Ogre::String &inst, const Ogre::String &box)
bool CheckActorCollAabbIntersect(int a, int b)
Returns whether or not the bounding boxes of truck a and truck b intersect. Based on the truck collis...
FreeForceID_t GetFreeForceNextId()
ActorPtrVec & GetActors()
const ActorPtr & GetActorByNetworkLinks(int source_id, int stream_id)
const ActorPtr & FetchPreviousVehicleOnList(ActorPtr player, ActorPtr prev_player)
std::pair< ActorPtr, float > GetNearestActor(Ogre::Vector3 position)
bool AreActorsDirectlyLinked(const ActorPtr &a1, const ActorPtr &a2)
std::map< int, int > m_stream_time_offsets
Networking: A network time offset for each stream source.
void SendAllActorsSleeping()
float GetTotalTime() const
void AddStreamMismatch(int sourceid, int streamid)
Builds and manages softbody actors (physics on background thread, networking)
float m_simulation_speed
slow motion < 1.0 < fast motion
std::map< int, std::set< int > > m_stream_mismatches
Networking: A set of streams without a corresponding actor in the actor-array for each stream source.
int ActorInstanceID_t
Unique sequentially generated ID of an actor in session. Use ActorManager::GetActorById()
void CalcFreeForces()
Apply FreeForces - intentionally as a separate pass over all actors.
void UpdateSleepingState(ActorPtr player_actor, float dt)
bool PredictActorCollAabbIntersect(int a, int b)
Returns whether or not the bounding boxes of truck a and truck b might intersect during the next fram...
float m_dt_remainder
Keeps track of the rounding error in the time step calculation.
void RemoveFreeForce(FreeForceID_t id)
Core data structures for simulation; Everything affected by by either physics, network or user intera...
FreeForceVec_t::iterator FindFreeForce(FreeForceID_t id)
std::vector< ActorPtr > ActorPtrVec
std::shared_ptr< Task > m_sim_task
void HandleActorStreamData(std::vector< RoR::NetRecvPacket > packet)
FreeForceID_t m_free_force_next_id
Unique ID for each FreeForce.
std::unique_ptr< ThreadPool > m_sim_thread_pool
std::vector< ActorPtr > GetLocalActors()
int FreeForceID_t
Unique sequentially generated ID of FreeForce; use ActorManager::GetFreeForceNextId().
std::vector< FreeForce > FreeForceVec_t
void UpdateNetTimeOffset(int sourceid, int offset)
Central state/object manager and communications hub.
const ActorPtr & FetchRescueVehicle()
float m_simulation_time
Amount of time the physics simulation is going to be advanced.
void SetSimulationSpeed(float speed)
float m_last_simulation_speed
previously used time ratio between real time (evt.timeSinceLastFrame) and physics time ('dt' used in ...
void RecursiveActivation(int j, std::vector< bool > &visited)
void DeleteActorInternal(ActorPtr actor)
Do not call directly; use GameContext::DeleteActor()
Common for ADD and MODIFY requests; tailored for use with AngelScript thru GameScript::pushMessage().
void UpdateInputEvents(float dt)
void SetTrucksForcedAwake(bool forced)
void ModifyFreeForce(FreeForceRequest *rq)
Loads and manages 'inertia_models.cfg'.
void SetSimulationPaused(bool v)
void UpdateTruckFeatures(ActorPtr vehicle, float dt)
void ForwardCommands(ActorPtr source_actor)
Fowards things to trailers.
RigDef::DocumentPtr FetchActorDef(RoR::ActorSpawnRequest &rq)
void RestoreSavedState(ActorPtr actor, rapidjson::Value const &j_entry)
void RepairActor(Collisions *collisions, const Ogre::String &inst, const Ogre::String &box, bool keepPosition=false)
std::shared_ptr< Document > DocumentPtr
RoR::CmdKeyInertiaConfig & GetInertiaConfig()
bool m_forced_awake
disables sleep counters
void UpdateActors(ActorPtr player_actor)
bool IsSimulationPaused() const
const ActorPtr & FetchNextVehicleOnList(ActorPtr player, ActorPtr prev_player)
bool LoadScene(Ogre::String filename)
const ActorPtr & GetActorById(ActorInstanceID_t actor_id)
FreeForceVec_t m_free_forces
Global forces added ad-hoc by scripts.
void CleanUpSimulation()
Call this after simulation loop finishes.
ActorPtr CreateNewActor(ActorSpawnRequest rq, RigDef::DocumentPtr def)
void UpdatePhysicsSimulation()
int CheckNetRemoteStreamsOk(int sourceid)