Skip to content

Commit 76049c7

Browse files
quazi-irfanstephengold
authored andcommitted
Add getSpatial to GhostControl, RigidBodyControl, AbstractPhysicsCont… (#1041)
* Add getSpatial to GhostControl, RigidBodyControl, AbstractPhysicsControl and CharacterControl. Fix issue 1008 * Fix doc: control is attached to spatial. Not the other way around. * Update doc: Clarify what getSpatial returns
1 parent 2124e3e commit 76049c7

File tree

4 files changed

+28
-0
lines changed

4 files changed

+28
-0
lines changed

jme3-bullet/src/common/java/com/jme3/bullet/control/AbstractPhysicsControl.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,13 @@ public void setSpatial(Spatial spatial) {
246246
setPhysicsRotation(getSpatialRotation());
247247
}
248248

249+
/**
250+
* @return returns the spatial the control is added to, or null if the control is not attached to a spatial yet.
251+
*/
252+
public Spatial getSpatial(){
253+
return this.spatial;
254+
}
255+
249256
/**
250257
* Enable or disable this control.
251258
* <p>

jme3-bullet/src/common/java/com/jme3/bullet/control/CharacterControl.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,13 @@ public void setSpatial(Spatial spatial) {
129129
setPhysicsLocation(getSpatialTranslation());
130130
}
131131

132+
/**
133+
* @return returns the spatial the control is added to, or null if the control is not attached to a spatial yet.
134+
*/
135+
public Spatial getSpatial(){
136+
return this.spatial;
137+
}
138+
132139
public void setEnabled(boolean enabled) {
133140
this.enabled = enabled;
134141
if (space != null) {

jme3-bullet/src/common/java/com/jme3/bullet/control/GhostControl.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,13 @@ public void setSpatial(Spatial spatial) {
206206
setPhysicsRotation(getSpatialRotation());
207207
}
208208

209+
/**
210+
* @return returns the spatial the control is added to, or null if the control is not attached to a spatial yet.
211+
*/
212+
public Spatial getSpatial(){
213+
return this.spatial;
214+
}
215+
209216
/**
210217
* Enable or disable this control.
211218
* <p>

jme3-bullet/src/common/java/com/jme3/bullet/control/RigidBodyControl.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,13 @@ public void setSpatial(Spatial spatial) {
207207
setPhysicsRotation(getSpatialRotation());
208208
}
209209

210+
/**
211+
* @return returns the spatial the control is added to, or null if the control is not attached to a spatial yet.
212+
*/
213+
public Spatial getSpatial(){
214+
return this.spatial;
215+
}
216+
210217
/**
211218
* Set the collision shape based on the controlled spatial and its
212219
* descendents.

0 commit comments

Comments
 (0)