Rigs of Rods 2023.09
Soft-body Physics Simulation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Loading...
Searching...
No Matches
Actor.h
Go to the documentation of this file.
1/*
2 This source file is part of Rigs of Rods
3 Copyright 2005-2012 Pierre-Michel Ricordel
4 Copyright 2007-2012 Thomas Fischer
5 Copyright 2016-2024 Petr Ohlidal
6
7 For more information, see http://www.rigsofrods.org/
8
9 Rigs of Rods is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License version 3, as
11 published by the Free Software Foundation.
12
13 Rigs of Rods is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>.
20*/
21
22#pragma once
23
24#include "AeroEngine.h"
25#include "Application.h"
26#include "AutoPilot.h"
27#include "CmdKeyInertia.h"
28#include "DashBoardManager.h"
29#include "Differentials.h"
30#include "Engine.h"
31#include "GfxActor.h"
34#include "RoRnet.h"
35#include "RefCountingObject.h"
37#include "ScrewProp.h"
38#include "SimData.h"
39#include "SoundScriptManager.h"
40#include "TyrePressure.h"
41#include "VehicleAI.h"
42
43#include <Ogre.h>
44
45namespace RoR {
46
49
54class Actor : public RefCountingObject<Actor>
55{
56 friend class ActorSpawner;
57 friend class ActorManager;
58 friend class GfxActor; // Temporary until all visuals are moved there. ~ only_a_ptr, 2018
59 friend class OutGauge;
60public:
61
62 Actor(
63 ActorInstanceID_t actor_id
64 , unsigned int vector_index
67 );
68
69 virtual ~Actor() override;
70
71 void dispose();
72
75 void sendStreamSetup();
76 void sendStreamData();
77 void pushNetwork(char* data, int size);
78 void calcNetwork();
80
83 // PLEASE maintain the same order as in 'scripting/bindings/ActorAngelscript.cpp' and 'doc/angelscript/.../BeamClass.h'
85 Ogre::Vector3 getPosition();
86 // AngelScript alias: `getVehiclePosition()`
87 float getRotation();
88 // AngelScript alias: `getHeadingDirectionAngle()`
89 Ogre::Quaternion getOrientation();
90 float getSpeed() { return m_avg_node_velocity.length(); };
91 Ogre::Vector3 getGForces() { return m_camera_local_gforces_cur; };
92 float getTotalMass(bool withLocked = true);
93 float getDryMass() { return ar_dry_mass; }
94 float getLoadedMass() { return ar_load_mass; }
97 int getNodeCount() { return ar_num_nodes; }
98 Ogre::Vector3 getNodePosition(int nodeNumber);
99 float getNodeInitialMass(int nodeNumber);
100 float getNodeMass(int nodeNumber);
101 Ogre::Vector3 getNodeVelocity(int nodeNumber);
102 Ogre::Vector3 getNodeForces(int nodeNumber);
103 void getNodeMassOptions(int nodeNumber, bool& loaded, bool& overrideMass);
104 bool isNodeWheelRim(int nodeNumber);
105 bool isNodeWheelTire(int nodeNumber);
106 int getWheelNodeCount() const;
107 float getWheelSpeed() const { return ar_wheel_speed; }
108 void reset(bool keep_position = false);
109 float getShockSpringRate(int shock_number);
110 float getShockDamping(int shock_number);
111 float getShockVelocity(int shock_number);
112 int getShockNode1(int shock_number);
113 int getShockNode2(int shock_number);
116 // not exported to scripting:
117 void resetPosition(Ogre::Vector3 translation, bool setInitPosition);
118 void resetPosition(float px, float pz, bool setInitPosition, float miny);
119 void softRespawn(Ogre::Vector3 spawnpos, Ogre::Quaternion spawnrot);
120 void requestRotation(float rotation, Ogre::Vector3 center) { m_rotation_request += rotation; m_rotation_request_center = center; };
121 void requestAngleSnap(int division) { m_anglesnap_request = division; };
122 void requestTranslation(Ogre::Vector3 translation) { m_translation_request += translation; };
123 int getShockCount() { return ar_num_shocks; }
124 Ogre::Vector3 getVelocity() const { return m_avg_node_velocity; };
125 Ogre::Vector3 getDirection();
126 Ogre::Vector3 getRotationCenter();
127 float getMinHeight(bool skip_virtual_nodes=true);
128 float getMaxHeight(bool skip_virtual_nodes=true);
129 float getHeightAboveGround(bool skip_virtual_nodes=true);
130 float getHeightAboveGroundBelow(float height, bool skip_virtual_nodes=true);
131 Ogre::Vector3 getMaxGForces() { return m_camera_local_gforces_max; };
132 bool hasSlidenodes() { return !m_slidenodes.empty(); };
134 void updateSlideNodeForces(const Ogre::Real delta_time_sec);
136 void resetSlideNodes();
138
141 // PLEASE maintain the same order as in 'scripting/bindings/ActorAngelscript.cpp' and 'doc/angelscript/.../BeamClass.h'
142 void scaleTruck(float value);
143 void setMass(float m);
144 void setLoadedMass(float m);
145 void setNodeMass(int nodeNumber, float m);
146 void setNodeMassOptions(int nodeNumber, bool loaded, bool overrideMass);
147 void setSimAttribute(ActorSimAttr attr, float val);
148 float getSimAttribute(ActorSimAttr attr);
150 void setAirbrakeIntensity(float intensity);
151 void setAircraftFlaps(int flapsLevel);
152 // not exported to scripting:
153 void applyNodeBeamScales();
154 void searchBeamDefaults();
155 void updateInitPosition();
158
161 // PLEASE maintain the same order as in 'scripting/bindings/ActorAngelscript.cpp' and 'doc/angelscript/.../BeamClass.h'
162 void parkingbrakeToggle();
164 void antilockbrakeToggle();
167 bool isLocked();
168 void setForcedCinecam(CineCameraID_t cinecam_id, BitMask_t flags);
169 void clearForcedCinecam();
170 bool getForcedCinecam(CineCameraID_t& cinecam_id, BitMask_t& flags);
172 // not exported to scripting:
173 void mouseMove(NodeNum_t node, Ogre::Vector3 pos, float force);
175 bool isTied();
178 void engineTriggerHelper(int engineNumber, EngineTriggerType type, float triggerValue);
179 void toggleSlideNodeLock();
181 void cruisecontrolToggle();
182 void toggleAxleDiffMode();
183 void displayAxleDiffMode();
185 void toggleWheelDiffMode();
186 void displayWheelDiffMode();
191 Ogre::String getTransferCaseName();
193 void setSmokeEnabled(bool enabled) { m_disable_smoke = !enabled; }
194 bool getSmokeEnabled() const { return !m_disable_smoke; }
196
199 // PLEASE maintain the same order as in 'scripting/bindings/ActorAngelscript.cpp' and 'doc/angelscript/.../BeamClass.h'
201 void setBlinkType(BlinkType blink);
202 void toggleBlinkType(BlinkType blink);
203 bool getCustomLightVisible(int number);
204 void setCustomLightVisible(int number, bool visible);
206 void beaconsToggle();
209 int countCustomLights(int control_number);
211 // not exported to scripting:
212 void toggleHeadlights();
214 void setLightStateMask(BitMask_t lightmask);
215 void importLightStateMask(BitMask_t lightmask);
219 void setHeadlightsVisible(bool val) { if (val != this->getHeadlightsVisible()) { this->toggleHeadlights(); } }
226
229 void updateSkidmarks();
230 void prepareInside(bool inside);
231 void updateFlareStates(float dt);
232 void updateVisual(float dt=0);
233 void updateDashBoards(float dt);
234 void forceAllFlaresOff();
236
239 void updateSoundSources();
240 void muteAllSounds();
241 void unmuteAllSounds();
243
250 AeroEnginePtr getTurbojet(int index);
251 AeroEnginePtr getTurboprop(int index);
254 ScrewpropPtr getScrewprop(int index);
255 Ogre::MaterialPtr getManagedMaterialInstance(const std::string& orig_name);
256 std::vector<std::string> getManagedMaterialNames();
257 // not exported to scripting:
258 Replay* getReplay();
262
265 // PLEASE maintain the same ordering as in 'scripting/bindings/ActorAngelscript.cpp' and 'doc/angelscript/.../BeamClass.h'
266 std::string getTruckName() { return ar_design_name; }
267 std::string getTruckFileName() { return ar_filename; }
268 std::string getTruckFileResourceGroup();
269 int getTruckType() { return ar_driveable; }
270 Ogre::String getSectionConfig() { return m_section_config; }
272 // not exported to scripting:
281 std::vector<authorinfo_t> getAuthors();
282 std::vector<std::string> getDescription();
284
285 void ForceFeedbackStep(int steps);
286 void HandleInputEvents(float dt);
287 void HandleAngelScriptEvents(float dt);
288 void UpdateCruiseControl(float dt);
289 bool Intersects(ActorPtr actor, Ogre::Vector3 offset = Ogre::Vector3::ZERO);
291 void resolveCollisions(Ogre::Vector3 direction);
294 void resolveCollisions(float max_distance, bool consider_up);
295 float getSteeringAngle();
297 int GetNumActiveConnectedBeams(int nodeid);
300 void UpdateBoundingBoxes();
302 void UpdatePhysicsOrigin();
303 void SoftReset();
304 void SyncReset(bool reset_position);
305 void WriteDiagnosticDump(std::string const& filename);
306 Ogre::Vector3 GetCameraDir() { return (ar_nodes[ar_main_camera_node_pos].RelPosition - ar_nodes[ar_main_camera_node_dir].RelPosition).normalisedCopy(); }
307 Ogre::Vector3 GetCameraRoll() { return (ar_nodes[ar_main_camera_node_pos].RelPosition - ar_nodes[ar_main_camera_node_roll].RelPosition).normalisedCopy(); }
308 Ogre::Vector3 GetFFbBodyForces() const { return m_force_sensors.out_body_forces; }
309 GfxActor* GetGfxActor() { return m_gfx_actor.get(); }
311 Ogre::Real getMinimalCameraRadius();
313 bool isBeingReset() const { return m_ongoing_reset; };
315
316 // -------------------- Public data -------------------- //
317
320 float ar_dry_mass = 0.f;
322 float ar_load_mass = 0.f;
324 int ar_masscount = 0;
325 float ar_total_mass = 0.f;
328
329 // Node data (split to layers)
330 node_t* ar_nodes = nullptr;
331 int* ar_nodes_id = nullptr;
332 std::string* ar_nodes_name = nullptr;
333 std::vector<float> ar_nodes_default_loadweights;
334 std::vector<float> ar_nodes_override_loadweights;
335 Ogre::Vector3* ar_nodes_spawn_offsets = nullptr;
336 std::vector<BitMask_t> ar_nodes_options;
337 std::vector<float> ar_minimass;
338 std::vector<float> ar_orig_minimass;
339 std::vector<float> ar_initial_node_masses;
340 std::vector<Ogre::Vector3> ar_initial_node_positions;
341
342 // Node additional info
346
347 // Beam data (split to layers)
348 beam_t* ar_beams = nullptr;
350 std::vector<std::pair<float, float>> ar_initial_beam_defaults;
351 std::vector<bool> ar_beams_invisible;
352 std::vector<bool> ar_beams_user_defined;
353
354 std::vector<beam_t*> ar_inter_beams;
355 shock_t* ar_shocks = nullptr;
357 bool ar_has_active_shocks = false;
360 wing_t* ar_wings = nullptr;
362 std::vector<authorinfo_t> authors;
363 std::vector<rope_t> ar_ropes;
364 std::vector<ropable_t> ar_ropables;
365 std::vector<tie_t> ar_ties;
366 std::vector<hook_t> ar_hooks;
367 std::vector<flare_t> ar_flares;
368 std::vector<Airbrake*> ar_airbrakes;
370 Ogre::AxisAlignedBox ar_bounding_box;
371 Ogre::AxisAlignedBox ar_evboxes_bounding_box;
372 Ogre::AxisAlignedBox ar_predicted_bounding_box;
373
374 std::vector<wheeldetacher_t> ar_wheeldetachers;
375 std::vector<std::vector<int>> ar_node_to_node_connections;
376 std::vector<std::vector<int>> ar_node_to_beam_connections;
377 std::vector<Ogre::AxisAlignedBox> ar_collision_bounding_boxes;
378 std::vector<Ogre::AxisAlignedBox> ar_predicted_coll_bounding_boxes;
379 std::map<std::string, Ogre::MaterialPtr> ar_managed_materials;
380 std::vector<UniqueCommandKeyPair> ar_unique_commandkey_pairs;
381
392 int ar_cabs[MAX_CABS * 3] = {};
394 int ar_num_cabs = 0;
395 std::vector<hydrobeam_t> ar_hydros;
406 Ogre::String ar_design_name;
408 float alb_ratio = 0.f;
409 float alb_minspeed = 0.f;
410 bool alb_mode = false;
411 float alb_pulse_time = 0.f;
412 bool alb_pulse_state = false;
413 bool alb_nodash = false;
414 bool alb_notoggle = false;
415 float alb_timer = 0.f;
417 bool cc_mode = false;
418 bool cc_can_brake = false;
419 float cc_target_rpm = 0.f;
420 float cc_target_speed = 0.f;
422 std::deque<float> cc_accs;
423 bool sl_enabled = false;
424 float sl_speed_limit = 0.f;
430 unsigned int ar_vector_index = 0;
436 float ar_brake_force = 0.f;
437
438 Ogre::Vector3 ar_origin = Ogre::Vector3::ZERO;
440 Ogre::Quaternion ar_main_camera_dir_corr = Ogre::Quaternion::IDENTITY;
448
451 float ar_scale = 1.f;
452 Ogre::Real ar_brake = 0.f;
453 float ar_wheel_speed = 0.f;
454 float ar_wheel_spin = 0.f;
455 float ar_avg_wheel_speed = 0.f;
465 float ar_sleep_counter = 0.f;
467 bool ar_parking_brake = false;
469 float ar_left_mirror_angle = 0.52f;
470 float ar_right_mirror_angle = -0.52f;
471 float ar_elevator = 0.f;
472 float ar_rudder = 0.f;
473 float ar_aileron = 0.f;
475 Ogre::Vector3 ar_fusedrag = Ogre::Vector3::ZERO;
476 std::string ar_filename;
477 std::string ar_filehash;
481 std::map<int,int> ar_net_stream_results;
482 Ogre::Timer ar_net_timer;
483 unsigned long ar_net_last_update_time = 0;
486 float ar_top_speed = 0.f;
489 std::vector<std::pair<collision_box_t*, NodeNum_t>> m_active_eventboxes;
490 std::unique_ptr<Buoyance> m_buoyance;
491
492 // Player camera 'cameras & cinecam'
493 // * 'cinecam#' creates dedicated node to dictate camera position + 6 attachment beams.
494 // * 'camera#' specifies a reference frame for the cinecam by referencing 3 preexisting nodes: ref, x, y.
495 // NOTE camera#0 is special - serves a general orientation frame for the whole actor. Cinecam#0 isn't required to exist, but camera#0 is.
501
502 // TractionControl
503 float tc_ratio = 0.f;
504 bool tc_mode = false;
505 float tc_pulse_time = 0.f;
506 bool tc_pulse_state = 0.f;
507 bool tc_nodash = false;
508 bool tc_notoggle = false;
509 float tc_timer = 0.f;
510 float tc_wheelslip_constant = 0.25f;
511
512 // Guisettings
516
517 // Gameplay state
520 bool m_ongoing_reset = false;
521 bool ar_physics_paused = false;
522 bool ar_muted_by_peeropt = false;
523
524 // Repair state
525 Ogre::Vector3 m_rotation_request_center = Ogre::Vector3::ZERO;
526 float m_rotation_request = 0.f;
528 Ogre::Vector3 m_translation_request = Ogre::Vector3::ZERO;
529
530 // Realtime node/beam structure editing helpers
531 bool ar_nb_initialized = false;
532 std::vector<float> ar_nb_optimum;
533 std::vector<float> ar_nb_reference;
537 std::pair<float, float> ar_nb_beams_scale;
538 std::pair<float, float> ar_nb_shocks_scale;
539 std::pair<float, float> ar_nb_wheels_scale;
540 std::pair<float, float> ar_nb_beams_d_interval;
541 std::pair<float, float> ar_nb_beams_k_interval;
542 std::pair<float, float> ar_nb_shocks_d_interval;
543 std::pair<float, float> ar_nb_shocks_k_interval;
544 std::pair<float, float> ar_nb_wheels_d_interval;
545 std::pair<float, float> ar_nb_wheels_k_interval;
546
547 // Bit flags
560
561private:
562
563 bool CalcForcesEulerPrepare(bool doUpdate);
564 void CalcAircraftForces(bool doUpdate);
565 void CalcForcesEulerCompute(bool doUpdate, int num_steps);
566 void CalcAnimators(hydrobeam_t const& hydrobeam, float &cstate, int &div);
567 void CalcBeams(bool trigger_hooks);
568 void CalcBeamsInterActor();
569 void CalcBuoyance(bool doUpdate);
570 void CalcCommands(bool doUpdate);
571 void CalcCabCollisions();
572 void CalcDifferentials();
573 void CalcForceFeedback(bool doUpdate);
574 void CalcFuseDrag();
575 void CalcHooks();
576 void CalcHydros();
577 void CalcMouse();
578 void CalcNodes();
579 void CalcEventBoxes();
580 void CalcReplay();
581 void CalcRopes();
582 void CalcShocks(bool doUpdate, int num_steps);
583 void CalcShocks2(int i, Ogre::Real difftoBeamL, Ogre::Real &k, Ogre::Real &d, Ogre::Real v);
584 void CalcShocks3(int i, Ogre::Real difftoBeamL, Ogre::Real &k, Ogre::Real &d, Ogre::Real v);
585 void CalcTriggers(int i, Ogre::Real difftoBeamL, bool update_hooks);
586 void CalcTies();
587 void CalcTruckEngine(bool doUpdate);
588 void CalcWheels(bool doUpdate, int num_steps);
589
595 void autoBlinkReset();
596 void ResetAngle(float rot);
597 void calculateLocalGForces();
600 // Both PointColDetectors need to be updated accordingly before calling this
601 Ogre::Vector3 calculateCollisionOffset(Ogre::Vector3 direction);
605 std::pair<RailGroup*, Ogre::Real> GetClosestRailOnActor( ActorPtr actor, const SlideNode& node);
606
607 // -------------------- data -------------------- //
608
609 std::vector<std::shared_ptr<Task>> m_flexbody_tasks;
610 std::unique_ptr<GfxActor> m_gfx_actor;
611 std::vector<SlideNode> m_slidenodes;
612 std::vector<RailGroup*> m_railgroups;
613 std::vector<Ogre::Entity*> m_deletion_entities;
614 std::vector<Ogre::SceneNode*> m_deletion_scene_nodes;
621
622 Ogre::Vector3 m_avg_node_position = Ogre::Vector3::ZERO;
623 Ogre::Real m_min_camera_radius = 0.f;
624 Ogre::Vector3 m_avg_node_position_prev = Ogre::Vector3::ZERO;
625 Ogre::Vector3 m_avg_node_velocity = Ogre::Vector3::ZERO;
629 Ogre::Vector3 m_mouse_grab_pos = Ogre::Vector3::ZERO;
631 float m_spawn_rotation = 0.f;
632 Ogre::Timer m_reset_timer;
633 Ogre::Vector3 m_camera_gforces_accu = Ogre::Vector3::ZERO;
634 Ogre::Vector3 m_camera_gforces = Ogre::Vector3::ZERO;
635 Ogre::Vector3 m_camera_local_gforces_cur = Ogre::Vector3::ZERO;
636 Ogre::Vector3 m_camera_local_gforces_max = Ogre::Vector3::ZERO;
646 float m_handbrake_force = 0.f;
650 float m_fusealge_width = 0.f;
651 float m_odometer_total = 0.f;
652 float m_odometer_user = 0.f;
654
656 bool m_antilockbrake = false;
657 bool m_tractioncontrol = false;
658 bool m_has_axles_section = false;
660 std::vector<std::string> m_description;
661 std::vector<PropAnimKeyState> m_prop_anim_key_states;
662
665 std::string m_section_config;
667 // cache entries
672
681
682 std::string m_net_username;
685
691 bool m_blinker_autoreset = false;
692 bool m_blinker_left_lit = false;
693 bool m_blinker_right_lit = false;
695
708
710 {
711 inline void Reset()
712 {
713 accu_body_forces = Ogre::Vector3::ZERO;
715 out_body_forces = Ogre::Vector3::ZERO;
717 };
718
719 Ogre::Vector3 accu_body_forces;
721 Ogre::Vector3 out_body_forces;
724
726 {
727 std::vector<char> veh_state;
728 std::vector<char> node_data;
729 std::vector<float> wheel_data;
730 };
731
732 std::deque<NetUpdate> m_net_updates;
733};
734
736
737} // namespace RoR
Central state/object manager and communications hub.
void BITMASK_SET(BitMask_t &mask, BitMask_t flag, bool val)
Definition BitFlags.h:19
uint32_t BitMask_t
Definition BitFlags.h:7
Manager for all visuals belonging to a single actor.
static const int MAX_CABS
maximum number of cabs per actor
static const int MAX_CAMERAS
maximum number of cameras per actor
static const int MAX_AEROENGINES
maximum number of aero engines per actor
static const int MAX_WHEELS
maximum number of wheels per actor
static const int MAX_SOUNDSCRIPTS_PER_TRUCK
maximum number of soundsscripts per actor
static const int MAX_CAMERARAIL
maximum number of camera rail points
static const int MAX_SCREWPROPS
maximum number of boat screws per actor
Core data structures for simulation; Everything affected by by either physics, network or user intera...
Wheel 'pressure adjustment' logic (only for 'wheels2')
Simple waypoint AI.
Self reference-counting objects, as requred by AngelScript garbage collector.
Softbody object; can be anything from soda can to a space shuttle Constructed from a truck definition...
Definition Actor.h:55
bool ar_hydro_speed_coupling
Definition Actor.h:551
bool ar_parking_brake
Definition Actor.h:467
Ogre::String getTransferCaseName()
Toggles between Hi and Lo mode.
Definition Actor.cpp:1536
bool alb_mode
Anti-lock brake state; Enabled? {1/0}.
Definition Actor.h:410
BlinkType getBlinkType()
Definition Actor.cpp:4609
std::pair< float, float > ar_nb_wheels_k_interval
Search interval for springiness & damping of wheel / rim beams.
Definition Actor.h:545
float m_odometer_user
GUI state.
Definition Actor.h:652
std::vector< std::vector< int > > ar_node_to_beam_connections
Definition Actor.h:376
wing_t * ar_wings
Definition Actor.h:360
int ar_num_screwprops
Definition Actor.h:391
int ar_num_wings
Definition Actor.h:361
float getInitialLoadedMass()
Definition Actor.h:96
void setHighBeamsVisible(bool val)
Definition Actor.h:221
BitMask_t ar_forced_cinecam_flags
Sim state; flags for forced CineCam supplied by script.
Definition Actor.h:500
bool ar_import_commands
Sim state.
Definition Actor.h:556
std::pair< float, float > ar_nb_shocks_k_interval
Search interval for springiness & damping of shock beams.
Definition Actor.h:543
std::vector< float > ar_orig_minimass
minimum node mass in Kg - original unscaled values
Definition Actor.h:338
NodeNum_t ar_custom_camera_node
Sim state; custom tracking node for 3rd-person camera.
Definition Actor.h:497
Ogre::AxisAlignedBox ar_bounding_box
standard bounding box (surrounds all nodes of an actor)
Definition Actor.h:370
ActorState getTruckState()
Definition Actor.h:84
int ar_nb_measure_steps
Amount of physics steps to be measured.
Definition Actor.h:535
int m_wheel_node_count
Static attr; filled at spawn.
Definition Actor.h:644
int m_num_command_beams
TODO: Remove! Spawner context only; likely unused feature.
Definition Actor.h:653
bool ar_update_physics
Physics state; Should this actor be updated (locally) in the next physics step?
Definition Actor.h:548
size_t m_net_total_buffer_size
For incoming/outgoing traffic; calculated on spawn.
Definition Actor.h:678
EnginePtr ar_engine
Definition Actor.h:432
void requestAngleSnap(int division)
Definition Actor.h:121
void resetSlideNodePositions()
Recalculate SlideNode positions.
float ar_collision_range
Physics attr.
Definition Actor.h:485
void updateSlideNodeForces(const Ogre::Real delta_time_sec)
calculate and apply Corrective forces
bool m_antilockbrake
GUI state.
Definition Actor.h:656
std::vector< Ogre::AxisAlignedBox > ar_predicted_coll_bounding_boxes
Definition Actor.h:378
BitMask_t getLightStateMask() const
Definition Actor.h:213
std::vector< float > ar_minimass
minimum node mass in Kg - can be scaled in-game via NBUtil
Definition Actor.h:337
TransferCase * m_transfer_case
Physics.
Definition Actor.h:643
float ar_guisettings_speedo_max_kph
Definition Actor.h:514
float ar_dry_mass
User-defined (editable via NBUtil); from 'globals' arg#1 - default for all nodes.
Definition Actor.h:320
void CalcCommands(bool doUpdate)
std::map< int, int > ar_net_stream_results
Definition Actor.h:481
int ar_airbrake_intensity
Physics state; values 0-5.
Definition Actor.h:478
void toggleTransferCaseGearRatio()
Definition Actor.cpp:1522
bool m_blinker_left_lit
Blinking state of left turn signal.
Definition Actor.h:692
float ar_hydro_elevator_state
Definition Actor.h:464
std::pair< float, float > ar_nb_beams_scale
Scales for springiness & damping of regular beams.
Definition Actor.h:537
bool ar_forward_commands
Sim state.
Definition Actor.h:555
int m_proped_wheel_pairs[MAX_WHEELS]
Physics attr; For inter-differential locking.
Definition Actor.h:615
void toggleSlideNodeLock()
void engineTriggerHelper(int engineNumber, EngineTriggerType type, float triggerValue)
Definition Actor.cpp:4401
void resetSlideNodes()
Reset all the SlideNodes.
CacheEntryPtr & getUsedSkinEntry()
Definition Actor.cpp:4878
void antilockbrakeToggle()
Definition Actor.cpp:3831
bool m_ongoing_reset
Hack to prevent position/rotation creep during interactive truck reset (aka LiveRepair).
Definition Actor.h:520
NodeNum_t ar_camera_node_dir[MAX_CAMERAS]
Physics attr; 'camera' = frame of reference; back node.
Definition Actor.h:445
void calcNodeConnectivityGraph()
Definition Actor.cpp:907
void CalcBeams(bool trigger_hooks)
float m_mouse_grab_move_force
Definition Actor.h:630
void sendStreamData()
Send outgoing data.
Definition Actor.cpp:2026
float ar_wheel_speed
Physics state; wheel speed in m/s.
Definition Actor.h:453
void updateSkidmarks()
Creates or updates skidmarks.
Definition Actor.cpp:2999
collcab_rate_t ar_intra_collcabrate[MAX_CABS]
Definition Actor.h:398
bool m_net_initialized
Definition Actor.h:698
std::vector< float > ar_nodes_override_loadweights
'nodes': 'l' flag and number.
Definition Actor.h:334
std::pair< RailGroup *, Ogre::Real > GetClosestRailOnActor(ActorPtr actor, const SlideNode &node)
CacheEntryPtrVec & getUsedAddonpartEntries()
Definition Actor.cpp:4883
Ogre::AxisAlignedBox ar_evboxes_bounding_box
bounding box around nodes eligible for eventbox triggering
Definition Actor.h:371
std::string ar_filehash
Attribute; filled at spawn.
Definition Actor.h:477
float ar_nb_minimass_scale
scale of 'set_default_minimass' (affects all nodes the same way)
Definition Actor.h:536
int GetNumActiveConnectedBeams(int nodeid)
Returns the number of active (non bounded) beams connected to a node.
Definition Actor.cpp:3913
std::vector< bool > ar_beams_invisible
Used only by the exporter (for rendering, invisible beams simply get no mesh).
Definition Actor.h:351
std::vector< ropable_t > ar_ropables
Definition Actor.h:364
BuoyCachedNodeID_t ar_cabs_buoy_cache_ids[MAX_CABS]
Definition Actor.h:393
float ar_top_speed
Sim state.
Definition Actor.h:486
CmdKeyArray ar_command_key
BEWARE: commandkeys are indexed 1-MAX_COMMANDS!
Definition Actor.h:369
wheel_t ar_wheels[MAX_WHEELS]
Definition Actor.h:384
std::vector< float > ar_nb_reference
Temporary storage of the reference search result.
Definition Actor.h:533
std::vector< rope_t > ar_ropes
Definition Actor.h:363
int getNumCinecams()
Definition Actor.h:171
void hookToggle(int group=-1, ActorLinkingRequestType mode=ActorLinkingRequestType::HOOK_TOGGLE, NodeNum_t mousenode=NODENUM_INVALID, ActorInstanceID_t forceunlock_filter=ACTORINSTANCEID_INVALID)
Definition Actor.cpp:3677
NodeNum_t m_mouse_grab_node
Sim state; node currently being dragged by user.
Definition Actor.h:628
DashBoardManagerPtr ar_dashboard
Definition Actor.h:484
float m_odometer_total
GUI state.
Definition Actor.h:651
float getSimAttribute(ActorSimAttr attr)
Definition Actor.cpp:5018
std::vector< wheeldetacher_t > ar_wheeldetachers
Definition Actor.h:374
int getScrewpropCount()
Definition Actor.h:253
void prepareInside(bool inside)
Prepares vehicle for in-cabin camera use.
Definition Actor.cpp:3023
void displayTransferCaseMode()
Gets the current transfer case mode name (4WD Hi, ...)
Definition Actor.cpp:1477
bool ar_camera_node_roll_inv[MAX_CAMERAS]
Physics attr; 'camera' = frame of reference; indicates roll node is right instead of left.
Definition Actor.h:447
float getWheelSpeed() const
Definition Actor.h:107
int ar_num_camera_rails
Definition Actor.h:404
int getWheelNodeCount() const
Definition Actor.cpp:902
float getMaxHeight(bool skip_virtual_nodes=true)
Definition Actor.cpp:1581
float tc_pulse_time
Definition Actor.h:505
bool getCustomParticleMode()
Definition Actor.cpp:4617
Ogre::Vector3 getNodeVelocity(int nodeNumber)
Definition Actor.cpp:4726
void ropeToggle(int group=-1, ActorLinkingRequestType mode=ActorLinkingRequestType::ROPE_TOGGLE, ActorInstanceID_t forceunlock_filter=ACTORINSTANCEID_INVALID)
Definition Actor.cpp:3600
float getInitialDryMass()
Definition Actor.h:95
void setSmokeEnabled(bool enabled)
Writes info to console/notify area.
Definition Actor.h:193
node_t * ar_nodes
Definition Actor.h:330
Ogre::Vector3 m_camera_gforces
Physics state (global)
Definition Actor.h:634
void calcNetwork()
Definition Actor.cpp:471
int ar_aerial_flap
Sim state; state of aircraft flaps (values: 0-5)
Definition Actor.h:474
void beaconsToggle()
Definition Actor.cpp:3849
void dispose()
Effectively destroys the object but keeps it in memory to satisfy shared pointers.
Definition Actor.cpp:89
float ar_original_load_mass
Un-edited value from 'globals' arg#2.
Definition Actor.h:323
void updateVisual(float dt=0)
Definition Actor.cpp:3285
int ar_buoycabs[MAX_CABS]
Definition Actor.h:400
float getSpeed()
Definition Actor.h:90
GfxActor * GetGfxActor()
Definition Actor.h:309
bool isNodeWheelRim(int nodeNumber)
Is node marked as wheel rim? Note some wheel models use only tire nodes. See https://docs....
Definition Actor.cpp:4764
Ogre::AxisAlignedBox ar_predicted_bounding_box
Definition Actor.h:372
void setNodeMass(int nodeNumber, float m)
Definition Actor.cpp:4522
std::vector< BitMask_t > ar_nodes_options
merged options from 'nodes' and 'set_node_defaults'
Definition Actor.h:336
Ogre::String ar_design_name
Name of the vehicle/machine/object this actor represents.
Definition Actor.h:406
void calculateLocalGForces()
Derive the truck local g-forces from the global ones.
Definition Actor.cpp:4379
int m_num_wheel_diffs
Physics attr.
Definition Actor.h:642
std::deque< float > cc_accs
Cruise Control.
Definition Actor.h:422
std::vector< bool > ar_beams_user_defined
True for 'beams', false for wheels/cinecam/hooknode/wings/rotators etc...
Definition Actor.h:352
bool ar_muted_by_peeropt
Muted by user in multiplayer (see RoRnet::PEEROPT_MUTE_ACTORS).
Definition Actor.h:522
DashBoardManagerPtr getDashboardManager()
Definition Actor.h:246
void updateFlareStates(float dt)
Definition Actor.cpp:3092
float getRotation()
Definition Actor.cpp:355
int m_num_proped_wheels
Physics attr, filled at spawn - Number of propelled wheels.
Definition Actor.h:616
bool m_disable_default_sounds
Spawner context; TODO: remove.
Definition Actor.h:706
bool isTied()
Definition Actor.cpp:3924
std::vector< Ogre::SceneNode * > m_deletion_scene_nodes
For unloading vehicle; filled at spawn.
Definition Actor.h:614
bool getHighBeamsVisible() const
Definition Actor.h:220
Ogre::Vector3 m_camera_local_gforces_max
Physics state (camera local)
Definition Actor.h:636
void CalcForceFeedback(bool doUpdate)
Ogre::Vector3 GetFFbBodyForces() const
Definition Actor.h:308
std::vector< tie_t > ar_ties
Definition Actor.h:365
Ogre::Vector3 m_avg_node_velocity
average node velocity (compared to the previous frame step)
Definition Actor.h:625
TyrePressure m_tyre_pressure
Definition Actor.h:659
void NotifyActorCameraChanged()
Logic: sound, display; Notify this vehicle that camera changed;.
Definition Actor.cpp:3893
float ar_hydro_rudder_state
Definition Actor.h:462
float ar_sleep_counter
Sim state; idle time counter.
Definition Actor.h:465
std::pair< float, float > ar_nb_wheels_scale
Scales for springiness & damping of wheel / rim beams.
Definition Actor.h:539
bool m_water_contact_old
Scripting state.
Definition Actor.h:700
void toggleHeadlights()
Definition Actor.cpp:3062
void mouseMove(NodeNum_t node, Ogre::Vector3 pos, float force)
Definition Actor.cpp:1400
int m_anglesnap_request
Accumulator.
Definition Actor.h:527
void CalcBuoyance(bool doUpdate)
float ar_original_dry_mass
Un-edited value from 'globals' arg#1.
Definition Actor.h:321
int m_num_axle_diffs
Physics attr.
Definition Actor.h:640
bool getSmokeEnabled() const
Definition Actor.h:194
float m_stabilizer_shock_ratio
Physics state.
Definition Actor.h:637
float ar_posnode_spawn_height
Definition Actor.h:449
CineCameraID_t ar_current_cinecam
Sim state; index of current CineCam (CINECAMERAID_INVALID if using 3rd-person camera)
Definition Actor.h:496
ground_model_t * ar_submesh_ground_model
Definition Actor.h:466
void updateDashBoards(float dt)
Definition Actor.cpp:3940
Replay * getReplay()
Definition Actor.cpp:4663
void CalcShocks(bool doUpdate, int num_steps)
std::vector< SlideNode > m_slidenodes
all the SlideNodes available on this actor
Definition Actor.h:611
float tc_wheelslip_constant
use ACTORSIMATTR_TC_WHEELSLIP_CONSTANT
Definition Actor.h:510
void DisjoinInterActorBeams()
Helper for MSG_ handlers, do not invoke by hand.
Definition Actor.cpp:3458
void importLightStateMask(BitMask_t lightmask)
Only for linked (locked/tied) actors forwarding flare states; see 'flaregroups_no_import' in ....
Definition Actor.cpp:3247
bool m_slidenodes_locked
Physics state; Are SlideNodes locked?
Definition Actor.h:697
void clearForcedCinecam()
Definition Actor.cpp:5074
float ar_initial_total_mass
Calculated; total mass in Kg (snapshot at spawn)
Definition Actor.h:326
int * ar_nodes_id
Number in truck file, -1 for nodes generated by wheels/cinecam.
Definition Actor.h:331
void updateInitPosition()
Definition Actor.cpp:1285
float getMinHeight(bool skip_virtual_nodes=true)
Definition Actor.cpp:1568
bool m_preloaded_with_terrain
Spawn context (TODO: remove!)
Definition Actor.h:702
void toggleWheelDiffMode()
Definition Actor.cpp:1407
std::vector< std::pair< float, float > > ar_initial_beam_defaults
Definition Actor.h:350
NodeNum_t ar_camera_node_roll[MAX_CAMERAS]
Physics attr; 'camera' = frame of reference; left node.
Definition Actor.h:446
Differential * m_axle_diffs[1+MAX_WHEELS/2]
Physics.
Definition Actor.h:639
ScrewpropPtr ar_screwprops[MAX_SCREWPROPS]
Definition Actor.h:390
unsigned int ar_vector_index
Sim attr; actor element index in std::vector<m_actors>
Definition Actor.h:430
void removeWorkingTuneupDef()
Deletes the working tuneup def object if it exists.
Definition Actor.cpp:4907
bool getBrakeLightVisible() const
Definition Actor.h:207
float m_spawn_rotation
Definition Actor.h:631
float m_net_node_compression
For incoming/outgoing traffic; calculated on spawn.
Definition Actor.h:679
void tieToggle(int group=-1, ActorLinkingRequestType mode=ActorLinkingRequestType::TIE_TOGGLE, ActorInstanceID_t forceunlock_filter=ACTORINSTANCEID_INVALID)
Definition Actor.cpp:3483
bool m_disable_smoke
Stops/starts smoke particles (i.e. exhausts, turbojets).
Definition Actor.h:707
Replay * m_replay_handler
Definition Actor.h:627
bool getParkingBrake()
Definition Actor.h:180
void setAirbrakeIntensity(float intensity)
Definition Actor.cpp:2974
NodeNum_t ar_main_camera_node_pos
Sim attr; ar_camera_node_pos[0] >= 0 ? ar_camera_node_pos[0] : 0.
Definition Actor.h:441
bool ar_nb_initialized
Definition Actor.h:531
Ogre::Vector3 getRotationCenter()
Definition Actor.cpp:1550
bool ar_is_police
Gfx/sfx attr.
Definition Actor.h:553
bool getSideLightsVisible() const
Definition Actor.h:216
std::vector< Airbrake * > ar_airbrakes
Definition Actor.h:368
void ResetAngle(float rot)
Definition Actor.cpp:1263
bool m_beam_break_debug_enabled
Logging state.
Definition Actor.h:703
bool ar_physics_paused
Actor physics individually paused by user.
Definition Actor.h:521
float ar_left_mirror_angle
Sim state; rear view mirror angle.
Definition Actor.h:469
AeroEnginePtr getTurbojet(int index)
Definition Actor.cpp:4632
int getShockNode2(int shock_number)
Definition Actor.cpp:4948
std::vector< float > ar_nodes_default_loadweights
'set_node_defaults': load weight.
Definition Actor.h:333
void CalcCabCollisions()
Definition Actor.cpp:2553
std::string getTruckName()
Definition Actor.h:266
Ogre::Timer ar_net_timer
Definition Actor.h:482
void toggleBlinkType(BlinkType blink)
Definition Actor.cpp:3153
float getShockSpringRate(int shock_number)
Definition Actor.cpp:4912
Ogre::Vector3 getPosition()
Definition Actor.cpp:370
bool m_tractioncontrol
GUI state.
Definition Actor.h:657
void toggleTransferCaseMode()
Definition Actor.cpp:1491
void ForceFeedbackStep(int steps)
Definition Actor.cpp:1837
bool ar_toggle_ropes
Sim state.
Definition Actor.h:557
float ar_hydro_dir_command
Definition Actor.h:456
Ogre::Vector3 getNodeForces(int nodeNumber)
Definition Actor.cpp:4738
NodeNum_t ar_camera_rail[MAX_CAMERARAIL]
Nodes defining camera-movement spline.
Definition Actor.h:403
void pushNetwork(char *data, int size)
Process incoming data; fills actor's data buffers and flips them. Called by the network thread....
Definition Actor.cpp:383
std::vector< float > ar_nb_optimum
Temporary storage of the optimum search result.
Definition Actor.h:532
int ar_buoycab_types[MAX_CABS]
Definition Actor.h:401
float m_fusealge_width
Physics attr; defined in truckfile.
Definition Actor.h:650
Airfoil * m_fusealge_airfoil
Physics attr; defined in truckfile.
Definition Actor.h:647
float ar_elevator
Sim state; aerial controller.
Definition Actor.h:471
std::vector< Ogre::AxisAlignedBox > ar_collision_bounding_boxes
smart bounding boxes, used for determining the state of an actor (every box surrounds only a subset o...
Definition Actor.h:377
void displayAxleDiffMode()
Cycles through the available inter axle diff modes.
Definition Actor.cpp:1423
void CalcShocks3(int i, Ogre::Real difftoBeamL, Ogre::Real &k, Ogre::Real &d, Ogre::Real v)
Definition Actor.cpp:2685
int m_net_color_num
Definition Actor.h:683
std::vector< authorinfo_t > getAuthors()
Definition Actor.cpp:4502
soundsource_t ar_soundsources[MAX_SOUNDSCRIPTS_PER_TRUCK]
Definition Actor.h:386
node_t * m_fusealge_front
Physics attr; defined in truckfile.
Definition Actor.h:648
std::vector< Ogre::Vector3 > ar_initial_node_positions
Absolute world positions, for resetting to pristine state.
Definition Actor.h:340
void ensureWorkingTuneupDef()
Creates a working tuneup def if it doesn't exist yet.
Definition Actor.cpp:4898
std::pair< float, float > ar_nb_wheels_d_interval
Search interval for springiness & damping of wheel / rim beams.
Definition Actor.h:544
void UpdatePhysicsOrigin()
Definition Actor.cpp:1250
void displayWheelDiffMode()
Cycles through the available inter wheel diff modes.
Definition Actor.cpp:1451
int ar_net_source_id
Unique ID of remote player who spawned this actor.
Definition Actor.h:479
bool ar_disable_aerodyn_turbulent_drag
Physics state.
Definition Actor.h:549
float ar_wheel_spin
Physics state; wheel speed in radians/s.
Definition Actor.h:454
void recalculateNodeMasses()
Definition Actor.cpp:701
std::vector< flare_t > ar_flares
Definition Actor.h:367
std::pair< float, float > ar_nb_beams_d_interval
Search interval for springiness & damping of regular beams.
Definition Actor.h:540
bool tc_mode
Enabled?
Definition Actor.h:504
std::vector< Ogre::Entity * > m_deletion_entities
For unloading vehicle; filled at spawn.
Definition Actor.h:613
std::unique_ptr< Buoyance > m_buoyance
Definition Actor.h:490
int getNodeCount()
Definition Actor.h:97
std::string m_net_username
Definition Actor.h:682
int ar_num_cabs
Definition Actor.h:394
bool alb_nodash
Anti-lock brake attribute: Hide the dashboard indicator?
Definition Actor.h:413
AeroEnginePtr getAircraftEngine(int index)
Definition Actor.cpp:4627
Ogre::Vector3 calculateCollisionOffset(Ogre::Vector3 direction)
Virtually moves the actor at most 'direction.length()' meters towards 'direction' trying to resolve a...
Definition Actor.cpp:992
void setHeadlightsVisible(bool val)
Definition Actor.h:219
int countFlaresByType(FlareType type)
Definition Actor.cpp:4598
bool sl_enabled
Speed limiter;.
Definition Actor.h:423
std::vector< std::string > getManagedMaterialNames()
Definition Actor.cpp:4680
unsigned long ar_net_last_update_time
Definition Actor.h:483
ExtCameraMode ar_extern_camera_mode
Definition Actor.h:425
float getAvgPropedWheelRadius()
Definition Actor.h:299
float ar_load_mass
User-defined (editable via NBUtil); from 'globals' arg#2 - only applies to nodes with 'l' flag.
Definition Actor.h:322
node_t * m_fusealge_back
Physics attr; defined in truckfile.
Definition Actor.h:649
float ar_right_mirror_angle
Sim state; rear view mirror angle.
Definition Actor.h:470
NodeNum_t ar_exhaust_dir_node
Old-format exhaust (one per vehicle) backwards direction node.
Definition Actor.h:428
void setSideLightsVisible(bool val)
Definition Actor.h:217
int ar_masscount
Calculated; Number of nodes loaded with l option.
Definition Actor.h:324
float getHeightAboveGround(bool skip_virtual_nodes=true)
Definition Actor.cpp:1594
void updateSoundSources()
Definition Actor.cpp:3268
bool m_blinker_right_lit
Blinking state of right turn signal.
Definition Actor.h:693
PointColDetector * m_inter_point_col_detector
Physics.
Definition Actor.h:619
float ar_hydro_elevator_command
Definition Actor.h:463
BitMask_t m_flaregroups_no_import
RoRnet::Lightmask.
Definition Actor.h:690
int m_stabilizer_shock_request
Physics state; values: { -1, 0, 1 }.
Definition Actor.h:638
void setSimAttribute(ActorSimAttr attr, float val)
HAZARDOUS - values may not be checked; Pay attention to 'safe values' at each attribute description.
Definition Actor.cpp:4957
AutopilotPtr getAutopilot()
Definition Actor.h:252
std::vector< RailGroup * > m_railgroups
all the available RailGroups for this actor
Definition Actor.h:612
Ogre::Vector3 getVelocity() const
Definition Actor.h:124
float m_handbrake_force
Physics attr; defined in truckfile.
Definition Actor.h:646
float ar_hydro_dir_state
Definition Actor.h:457
NodeNum_t ar_extern_camera_node
Definition Actor.h:426
bool ar_engine_hydraulics_ready
Sim state; does engine have enough RPM to power hydraulics?
Definition Actor.h:550
Ogre::Vector3 ar_origin
Physics state; base position for softbody nodes.
Definition Actor.h:438
float ar_guisettings_shifter_anim_time
Definition Actor.h:515
int getWheelDiffMode()
Writes info to console/notify box.
Definition Actor.h:187
int getInstanceId()
Definition Actor.h:271
ActorState ar_state
Definition Actor.h:518
float m_stabilizer_shock_sleep
Sim state.
Definition Actor.h:626
bool getCustomLightVisible(int number)
Definition Actor.cpp:4539
float ar_brake_force
Physics attr; filled at spawn.
Definition Actor.h:436
size_t m_net_wheel_buf_size
For incoming/outgoing traffic; calculated on spawn.
Definition Actor.h:676
std::unique_ptr< GfxActor > m_gfx_actor
Definition Actor.h:610
void RemoveInterActorBeam(beam_t *beam, ActorLinkingRequestType type)
Do not call directly - use MSG_SIM_ACTOR_LINKING_REQUESTED
Definition Actor.cpp:3405
void updateSlideNodePositions()
incrementally update the position of all SlideNodes
void sendStreamSetup()
Definition Actor.cpp:1996
Ogre::Vector3 getDirection()
average actor velocity, calculated using the actor positions of the last two frames
Definition Actor.cpp:365
float getLoadedMass()
Definition Actor.h:94
float getHeightAboveGroundBelow(float height, bool skip_virtual_nodes=true)
Definition Actor.cpp:1608
NodeNum_t ar_exhaust_pos_node
Old-format exhaust (one per vehicle) emitter node.
Definition Actor.h:427
Ogre::Vector3 m_translation_request
Accumulator.
Definition Actor.h:528
size_t m_net_propanimkey_buf_size
For incoming/outgoing traffic; calculated on spawn.
Definition Actor.h:677
float tc_timer
Definition Actor.h:509
TransferCase * getTransferCaseMode()
Toggles between 2WD and 4WD mode.
Definition Actor.h:189
AeroEnginePtr ar_aeroengines[MAX_AEROENGINES]
Definition Actor.h:388
float ar_hydro_aileron_command
Definition Actor.h:459
std::string getTruckFileName()
Definition Actor.h:267
bool isBeingReset() const
Definition Actor.h:313
int ar_num_shocks
Number of shock absorbers.
Definition Actor.h:356
void setNodeMassOptions(int nodeNumber, bool loaded, bool overrideMass)
Definition Actor.cpp:4530
float m_avionic_chatter_timer
Sound fx state (some pseudo random number, doesn't matter)
Definition Actor.h:618
void forceAllFlaresOff()
Definition Actor.cpp:3084
float ar_total_mass
Calculated; total mass in Kg.
Definition Actor.h:325
void setLightStateMask(BitMask_t lightmask)
Does all the necessary toggling.
Definition Actor.cpp:3224
void applyNodeBeamScales()
For GUI::NodeBeamUtils.
Definition Actor.cpp:1814
void propagateNodeBeamChangesToDef()
Back-propagates changes done by N/B-utils UI to the def-document.
void HandleInputEvents(float dt)
Definition Actor.cpp:1949
Ogre::Vector3 getNodePosition(int nodeNumber)
Returns world position of node.
Definition Actor.cpp:4690
float ar_hydro_aileron_state
Definition Actor.h:460
int getAxleDiffMode()
Writes info to console/notify box.
Definition Actor.h:184
int ar_num_aeroengines
Definition Actor.h:389
float ar_anim_shift_timer
For 'animator' with flag 'shifter'.
Definition Actor.h:416
void setForcedCinecam(CineCameraID_t cinecam_id, BitMask_t flags)
Definition Actor.cpp:5068
void WriteDiagnosticDump(std::string const &filename)
Definition Actor.cpp:4788
void SoftReset()
Definition Actor.cpp:1633
float alb_ratio
Anti-lock brake attribute: Regulating force.
Definition Actor.h:408
float cc_target_speed_lower_limit
Cruise Control.
Definition Actor.h:421
Ogre::MaterialPtr getManagedMaterialInstance(const std::string &orig_name)
Definition Actor.cpp:4671
float GetFFbHydroForces() const
Definition Actor.h:312
std::map< std::string, Ogre::MaterialPtr > ar_managed_materials
Definition Actor.h:379
void searchBeamDefaults()
Searches for more stable beam defaults.
Definition Actor.cpp:1858
int ar_num_beams
Definition Actor.h:349
float getShockVelocity(int shock_number)
Definition Actor.cpp:4930
void getNodeMassOptions(int nodeNumber, bool &loaded, bool &overrideMass)
Definition Actor.cpp:4750
void requestRotation(float rotation, Ogre::Vector3 center)
Definition Actor.h:120
std::vector< authorinfo_t > authors
Definition Actor.h:362
bool m_beam_deform_debug_enabled
Logging state.
Definition Actor.h:704
float getSteeringAngle()
Definition Actor.cpp:4497
PerVehicleCameraContext ar_camera_context
Definition Actor.h:498
int countCustomLights(int control_number)
Definition Actor.cpp:4581
std::vector< std::string > getDescription()
Definition Actor.cpp:4507
void UpdatePropAnimInputEvents()
Definition Actor.cpp:4846
void toggleAxleDiffMode()
Definition Actor.cpp:1415
ActorInstanceID_t ar_instance_id
Static attr; session-unique ID.
Definition Actor.h:429
void autoBlinkReset()
Resets the turn signal when the steering wheel is turned back.
Definition Actor.cpp:3195
void requestTranslation(Ogre::Vector3 translation)
Definition Actor.h:122
void muteAllSounds()
Definition Actor.cpp:3865
void setCustomLightVisible(int number, bool visible)
Definition Actor.cpp:4561
float ar_rudder
Sim state; aerial/marine controller.
Definition Actor.h:472
ActorPtrVec ar_linked_actors
BEWARE: Includes indirect links, see DetermineLinkedActors(); Other actors linked using 'hooks/ties/r...
Definition Actor.h:519
std::vector< std::shared_ptr< Task > > m_flexbody_tasks
Gfx state.
Definition Actor.h:609
bool alb_notoggle
Anti-lock brake attribute: Disable in-game toggle?
Definition Actor.h:414
void SyncReset(bool reset_position)
this one should be called only synchronously (without physics running in background)
Definition Actor.cpp:1657
int getAircraftEngineCount()
Definition Actor.h:248
float ar_avg_wheel_speed
Physics state; avg wheel speed in m/s.
Definition Actor.h:455
std::vector< PropAnimKeyState > m_prop_anim_key_states
Definition Actor.h:661
bool m_has_axles_section
Temporary (legacy parsing helper) until central diffs are implemented.
Definition Actor.h:658
rotator_t * ar_rotators
Definition Actor.h:358
Ogre::Real ar_brake
Physics state; braking intensity.
Definition Actor.h:452
bool isPreloadedWithTerrain() const
Definition Actor.h:280
Ogre::Vector3 m_camera_gforces_accu
Accumulator for 'camera' G-forces.
Definition Actor.h:633
bool ar_minimass_skip_loaded_nodes
Definition Actor.h:343
std::string ar_filename
Attribute; filled at spawn.
Definition Actor.h:476
std::string * ar_nodes_name
Name in truck file, only if defined with 'nodes2'.
Definition Actor.h:332
void RequestUpdateHudFeatures()
Definition Actor.h:310
bool ar_cparticles_active
Gfx state.
Definition Actor.h:559
float cc_target_rpm
Cruise Control.
Definition Actor.h:419
void CalcShocks2(int i, Ogre::Real difftoBeamL, Ogre::Real &k, Ogre::Real &d, Ogre::Real v)
Definition Actor.cpp:2574
NodeNum_t ar_camera_node_pos[MAX_CAMERAS]
Physics attr; 'camera' = frame of reference; origin node.
Definition Actor.h:444
Ogre::Real m_min_camera_radius
Definition Actor.h:623
virtual ~Actor() override
Definition Actor.cpp:82
VehicleAIPtr getVehicleAI()
Definition Actor.h:247
Ogre::Vector3 getMaxGForces()
Definition Actor.h:131
int ar_num_cinecams
Sim attr;.
Definition Actor.h:434
bool getBeaconMode() const
Definition Actor.h:205
CacheEntryPtr m_used_actor_entry
Required.
Definition Actor.h:668
GfxFlaresMode m_flares_mode
Snapshot of cvar 'gfx_flares_mode' on spawn.
Definition Actor.h:688
collcab_rate_t ar_inter_collcabrate[MAX_CABS]
Definition Actor.h:397
TyrePressure & getTyrePressure()
Definition Actor.h:259
std::string m_section_config
Classic 'sectionconfig' in truck file.
Definition Actor.h:665
bool cc_mode
Cruise Control.
Definition Actor.h:417
bool isNodeWheelTire(int nodeNumber)
Is node marked as wheel tire? Note some wheel models use only tire nodes. See https://docs....
Definition Actor.cpp:4776
void CalcAnimators(hydrobeam_t const &hydrobeam, float &cstate, int &div)
Definition Actor.cpp:2164
Differential * m_wheel_diffs[MAX_WHEELS/2]
Physics.
Definition Actor.h:641
bool ar_hide_in_actor_list
Hide in list of spawned actors (available in top menubar). Useful for fixed-place machinery,...
Definition Actor.h:405
int getAircraftFlaps()
Definition Actor.h:115
void unmuteAllSounds()
Definition Actor.cpp:3879
std::deque< NetUpdate > m_net_updates
Incoming stream of NetUpdates.
Definition Actor.h:732
float alb_pulse_time
Anti-lock brake attribute;.
Definition Actor.h:411
int ar_cabs[MAX_CABS *3]
Definition Actor.h:392
void parkingbrakeToggle()
Definition Actor.cpp:3816
Ogre::Real getMinimalCameraRadius()
Definition Actor.cpp:4622
bool m_water_contact
Scripting state.
Definition Actor.h:699
int ar_num_collcabs
Definition Actor.h:399
float ar_hydro_rudder_command
Definition Actor.h:461
int ar_num_nodes
Definition Actor.h:345
void CalcAircraftForces(bool doUpdate)
Skidmark * m_skid_trails[MAX_WHEELS *2]
Definition Actor.h:655
bool tc_pulse_state
Definition Actor.h:506
std::vector< beam_t * > ar_inter_beams
Beams connecting 2 actors.
Definition Actor.h:354
float alb_minspeed
Anti-lock brake attribute;.
Definition Actor.h:409
float getMinCameraRadius()
Definition Actor.h:296
void CalcForcesEulerCompute(bool doUpdate, int num_steps)
Ogre::Quaternion ar_main_camera_dir_corr
Sim attr;.
Definition Actor.h:440
Ogre::Vector3 m_mouse_grab_pos
Definition Actor.h:629
std::pair< float, float > ar_nb_shocks_scale
Scales for springiness & damping of shock beams.
Definition Actor.h:538
bool m_has_command_beams
Physics attr;.
Definition Actor.h:701
void setBlinkType(BlinkType blink)
Definition Actor.cpp:3161
std::vector< std::string > m_description
Definition Actor.h:660
CineCameraID_t ar_forced_cinecam
Sim state; index of CineCam forced by script (CINECAMERAID_INVALID if not forced)
Definition Actor.h:499
ground_model_t * ar_last_fuzzy_ground_model
GUI state.
Definition Actor.h:487
bool m_blinker_autoreset
When true, we're steering and blinker will turn off automatically.
Definition Actor.h:691
VehicleAIPtr ar_vehicle_ai
Definition Actor.h:450
BitMask_t m_lightmask
RoRnet::Lightmask.
Definition Actor.h:689
float getTotalMass(bool withLocked=true)
Definition Actor.cpp:843
int getShockNode1(int shock_number)
Definition Actor.cpp:4939
float getShockDamping(int shock_number)
Definition Actor.cpp:4921
void scaleTruck(float value)
Definition Actor.cpp:315
float ar_anim_previous_crank
For 'animator' with flag 'torque'.
Definition Actor.h:407
void CalcTriggers(int i, Ogre::Real difftoBeamL, bool update_hooks)
Definition Actor.cpp:2717
Ogre::String getSectionConfig()
Definition Actor.h:270
std::string getTruckFileResourceGroup()
Definition Actor.cpp:4868
Ogre::Vector3 ar_fusedrag
Physics state.
Definition Actor.h:475
bool tc_notoggle
Disable in-game toggle?
Definition Actor.h:508
float ar_aileron
Sim state; aerial controller.
Definition Actor.h:473
EnginePtr getEngine()
Definition Actor.h:260
void HandleAngelScriptEvents(float dt)
Definition Actor.cpp:1846
int getShockCount()
Definition Actor.h:123
AutopilotPtr ar_autopilot
Definition Actor.h:435
float ar_scale
Physics state; scale of the actor (nominal = 1.0)
Definition Actor.h:451
float tc_ratio
Regulating force.
Definition Actor.h:503
float alb_timer
Anti-lock brake state;.
Definition Actor.h:415
void CalcTruckEngine(bool doUpdate)
bool hasSlidenodes()
Definition Actor.h:132
int ar_num_soundsources
Definition Actor.h:387
void resolveCollisions(Ogre::Vector3 direction)
Moves the actor at most 'direction.length()' meters towards 'direction' to resolve any collisions.
Definition Actor.cpp:1108
int ar_num_contacters
Total number of nodes which can selfcontact cabs.
Definition Actor.h:383
std::vector< hydrobeam_t > ar_hydros
Definition Actor.h:395
int ar_nodes_name_top_length
For nicely formatted diagnostic output.
Definition Actor.h:344
bool ar_rescuer_flag
Gameplay attr; defined in truckfile. TODO: Does anybody use this anymore?
Definition Actor.h:554
std::vector< std::pair< collision_box_t *, NodeNum_t > > m_active_eventboxes
Definition Actor.h:489
NodeNum_t ar_main_camera_node_dir
Sim attr; ar_camera_node_dir[0] >= 0 ? ar_camera_node_dir[0] : 0.
Definition Actor.h:442
Ogre::Vector3 GetCameraDir()
Definition Actor.h:306
std::vector< std::vector< int > > ar_node_to_node_connections
Definition Actor.h:375
int ar_num_cameras
Definition Actor.h:439
void calculateAveragePosition()
Definition Actor.cpp:1166
bool getFogLightsVisible() const
Definition Actor.h:222
std::pair< float, float > ar_nb_shocks_d_interval
Search interval for springiness & damping of shock beams.
Definition Actor.h:542
Ogre::Quaternion getOrientation()
Definition Actor.cpp:375
std::vector< hook_t > ar_hooks
Definition Actor.h:366
void UpdateBoundingBoxes()
Definition Actor.cpp:1201
bool ar_collision_relevant
Physics state;.
Definition Actor.h:552
void tractioncontrolToggle()
Definition Actor.cpp:3840
PointColDetector * m_intra_point_col_detector
Physics.
Definition Actor.h:620
int ar_num_wheels
Definition Actor.h:385
void setMass(float m)
Definition Actor.cpp:4512
float getNodeMass(int nodeNumber)
Definition Actor.cpp:4714
void AddInterActorBeam(beam_t *beam, ActorPtr other, ActorLinkingRequestType type)
Do not call directly - use MSG_SIM_ACTOR_LINKING_REQUESTED
Definition Actor.cpp:3364
void UpdateCruiseControl(float dt)
Defined in 'gameplay/CruiseControl.cpp'.
CacheEntryPtr m_used_skin_entry
Optional, only graphics.
Definition Actor.h:669
int m_previous_gear
Sim state; land vehicle shifting.
Definition Actor.h:645
std::pair< float, float > ar_nb_beams_k_interval
Search interval for springiness & damping of regular beams.
Definition Actor.h:541
ScrewpropPtr getScrewprop(int index)
Definition Actor.cpp:4658
float m_rotation_request
Accumulator.
Definition Actor.h:526
shock_t * ar_shocks
Shock absorbers.
Definition Actor.h:355
int m_net_first_wheel_node
Network attr; Determines data buffer layout; calculated on spawn.
Definition Actor.h:680
Ogre::Vector3 m_camera_local_gforces_cur
Physics state (camera local)
Definition Actor.h:635
CacheEntryPtr & getUsedActorEntry()
The actor entry itself.
Definition Actor.cpp:4873
Ogre::Vector3 GetCameraRoll()
Definition Actor.h:307
bool CalcForcesEulerPrepare(bool doUpdate)
bool tc_nodash
Hide the dashboard indicator?
Definition Actor.h:507
NodeNum_t ar_cinecam_node[MAX_CAMERAS]
Sim attr; Cine-camera node indexes.
Definition Actor.h:433
Ogre::Vector3 * ar_nodes_spawn_offsets
Relative positions (incl. Tuning system tweaks) from the definition file, for spawn-like resetting (i...
Definition Actor.h:335
bool alb_pulse_state
Anti-lock brake state;.
Definition Actor.h:412
Ogre::Vector3 m_avg_node_position
average node position
Definition Actor.h:622
bool getReverseLightVisible() const
Definition Actor.h:208
bool Intersects(ActorPtr actor, Ogre::Vector3 offset=Ogre::Vector3::ZERO)
Slow intersection test.
Definition Actor.cpp:926
void toggleCustomParticles()
Definition Actor.cpp:3257
CacheEntryPtrVec m_used_addonpart_entries
Optional, assigned by player via Tuning menu (.tuneup files).
Definition Actor.h:670
bool m_hud_features_ok
Gfx state; Are HUD features matching actor's capabilities?
Definition Actor.h:696
Ogre::Real ar_hydro_dir_wheel_display
Definition Actor.h:458
float m_avg_proped_wheel_radius
Physics attr, filled at spawn - Average proped wheel radius.
Definition Actor.h:617
size_t m_net_node_buf_size
For incoming/outgoing traffic; calculated on spawn.
Definition Actor.h:675
float getAirbrakeIntensity()
Definition Actor.h:114
int getTruckType()
Definition Actor.h:269
void softRespawn(Ogre::Vector3 spawnpos, Ogre::Quaternion spawnrot)
Use MSG_SIM_MODIFY_ACTOR_REQUESTED with type SOFT_RESPAWN; Resets the actor to given position as if s...
Definition Actor.cpp:1376
void setFogLightsVisible(bool val)
Definition Actor.h:223
bool m_trigger_debug_enabled
Logging state.
Definition Actor.h:705
beam_t * ar_beams
Definition Actor.h:348
void DetermineLinkedActors()
Definition Actor.cpp:861
bool ar_trailer_parking_brake
Definition Actor.h:468
void reset(bool keep_position=false)
call this one to reset a truck from any context
Definition Actor.cpp:1622
int ar_num_buoycabs
Definition Actor.h:402
struct RoR::Actor::VehicleForceSensors m_force_sensors
Data for ForceFeedback devices.
bool ar_toggle_ties
Sim state.
Definition Actor.h:558
CacheEntryPtrVec m_used_assetpack_entries
Optional, specified by mod author in truck file via 'assetpacks' section.
Definition Actor.h:671
Ogre::Timer m_reset_timer
Definition Actor.h:632
int ar_collcabs[MAX_CABS]
Definition Actor.h:396
void setAircraftFlaps(int flapsLevel)
Definition Actor.cpp:2988
float getNodeInitialMass(int nodeNumber)
Definition Actor.cpp:4702
float getDryMass()
Definition Actor.h:93
int ar_nb_skip_steps
Amount of physics steps to be skipped before measuring.
Definition Actor.h:534
bool ar_has_active_shocks
Are there active stabilizer shocks?
Definition Actor.h:357
CacheEntryPtrVec & getUsedAssetpackEntries()
Definition Actor.cpp:4888
int ar_num_contactable_nodes
Total number of nodes which can contact ground or cabs.
Definition Actor.h:382
TuneupDefPtr m_working_tuneup_def
Each actor gets unique instance, even if loaded from .tuneup file in modcache.
Definition Actor.h:666
std::vector< float > ar_initial_node_masses
Definition Actor.h:339
void resetPosition(Ogre::Vector3 translation, bool setInitPosition)
Moves the actor to given world coords (pivot point is node 0).
Definition Actor.cpp:1351
TuneupDefPtr & getWorkingTuneupDef()
Definition Actor.cpp:4893
bool ar_guisettings_use_engine_max_rpm
Definition Actor.h:513
CollisionBoxPtrVec m_potential_eventboxes
Definition Actor.h:488
void CalcWheels(bool doUpdate, int num_steps)
bool getForcedCinecam(CineCameraID_t &cinecam_id, BitMask_t &flags)
Definition Actor.cpp:5079
float cc_target_speed
Cruise Control.
Definition Actor.h:420
bool isLocked()
Are hooks locked?
Definition Actor.cpp:3932
float sl_speed_limit
Speed limiter;.
Definition Actor.h:424
int ar_num_rotators
Definition Actor.h:359
Ogre::Vector3 m_avg_node_position_prev
Definition Actor.h:624
ActorType ar_driveable
Sim attr; marks vehicle type and features.
Definition Actor.h:431
int ar_net_stream_id
Definition Actor.h:480
void setLoadedMass(float m)
Definition Actor.cpp:4517
void setBeaconMode(bool val)
Definition Actor.h:224
Ogre::Vector3 getGForces()
Definition Actor.h:91
NodeNum_t ar_main_camera_node_roll
Sim attr; ar_camera_node_roll[0] >= 0 ? ar_camera_node_roll[0] : 0.
Definition Actor.h:443
AeroEnginePtr getTurboprop(int index)
Definition Actor.cpp:4645
bool cc_can_brake
Cruise Control.
Definition Actor.h:418
void cruisecontrolToggle()
Defined in 'gameplay/CruiseControl.cpp'.
std::vector< UniqueCommandKeyPair > ar_unique_commandkey_pairs
UI helper for displaying command control keys to user (must be built at spawn).
Definition Actor.h:380
bool getHeadlightsVisible() const
Definition Actor.h:218
Ogre::Vector3 m_rotation_request_center
Definition Actor.h:525
Builds and manages softbody actors (physics on background thread, networking)
Processes a RigDef::Document (parsed from 'truck' file format) into a simulated gameplay object (Acto...
Represents an airfoil http://en.wikipedia.org/wiki/Airfoil.
Definition Airfoil.h:32
For backwards compatibility of the 'triggers' feature, the commandkey array must support negative ind...
Definition SimData.h:632
Land vehicle feat Simulates tyre pressurization by adjusting springness of in-wheel beams.
std::vector< collision_box_t * > CollisionBoxPtrVec
Definition SimData.h:700
BlinkType
< Turn signal
Definition SimData.h:114
ActorType
< Aka 'Driveable'
Definition SimData.h:81
EngineTriggerType
Definition SimData.h:212
@ NOT_DRIVEABLE
not drivable at all
Definition SimData.h:84
static const float DEFAULT_COLLISION_RANGE
ActorState
Definition SimData.h:239
@ LOCAL_SIMULATED
simulated (local) actor
std::shared_ptr< Document > DocumentPtr
static const NodeNum_t NODENUM_INVALID
std::vector< ActorPtr > ActorPtrVec
GfxFlaresMode
@ NONE
None (fastest)
int ActorInstanceID_t
Unique sequentially generated ID of an actor in session. Use ActorManager::GetActorById()
int CineCameraID_t
Index into Actor::ar_cinecam_node and Actor::ar_camera_node_* arrays; use RoR::CINECAMERAID_INVALID a...
ActorLinkingRequestType
Definition SimData.h:886
ActorSimAttr
Parameter to Actor::setSimAttribute() and Actor::getSimAttribute(); allows advanced users to tweak ph...
Definition SimData.h:925
static const ActorInstanceID_t ACTORINSTANCEID_INVALID
std::vector< CacheEntryPtr > CacheEntryPtrVec
static const CineCameraID_t CINECAMERAID_INVALID
ExtCameraMode
int BuoyCachedNodeID_t
uint16_t NodeNum_t
Node position within Actor::ar_nodes; use RoR::NODENUM_INVALID as empty value.
@ LIGHTMASK_REVERSE
reverse light on
Definition RoRnet.h:121
@ LIGHTMASK_BEACONS
beacons on
Definition RoRnet.h:122
@ LIGHTMASK_BRAKES
brake lights on
Definition RoRnet.h:120
@ LIGHTMASK_FOGLIGHTS
Definition RoRnet.h:118
@ LIGHTMASK_HEADLIGHT
Definition RoRnet.h:116
@ LIGHTMASK_HIGHBEAMS
Definition RoRnet.h:117
@ LIGHTMASK_SIDELIGHTS
Definition RoRnet.h:119
std::vector< char > veh_state
Actor properties (engine, brakes, lights, ...)
Definition Actor.h:727
std::vector< char > node_data
Compressed node positions.
Definition Actor.h:728
std::vector< float > wheel_data
Wheel rotations.
Definition Actor.h:729
Ogre::Vector3 out_body_forces
Definition Actor.h:721
Ogre::Vector3 accu_body_forces
Definition Actor.h:719
Simulation: An edge in the softbody structure.
Definition SimData.h:305
Surface friction properties.
Definition SimData.h:704
< beams updating length based on simulation variables, generally known as actuators.
Definition SimData.h:571
Physics: A vertex in the softbody structure.
Definition SimData.h:260