Bladeren bron

Add a method to retrieve the UnitId of an actor

Daniele Bartolini 11 jaren geleden
bovenliggende
commit
68a492a56f
2 gewijzigde bestanden met toevoegingen van 9 en 0 verwijderingen
  1. 6 0
      engine/physics/Actor.cpp
  2. 3 0
      engine/physics/Actor.h

+ 6 - 0
engine/physics/Actor.cpp

@@ -541,6 +541,12 @@ void Actor::wake_up()
 	static_cast<PxRigidDynamic*>(m_actor)->wakeUp();
 }
 
+//-----------------------------------------------------------------------------
+UnitId Actor::unit_id() const
+{
+	return m_unit;
+}
+
 //-----------------------------------------------------------------------------
 Unit* Actor::unit()
 {

+ 3 - 0
engine/physics/Actor.h

@@ -163,6 +163,9 @@ struct Actor
 	/// Wakes the actor up.
 	void wake_up();
 
+	/// Returns the id of the unit that owns the actor.
+	UnitId unit_id() const;
+
 	/// Returns the unit that owns the actor.
 	Unit* unit();