Hey guys, I’m having a little trouble with selecting a model using ray casting. I mean, I got the general idea to work, I can make a unit move to a spot based on where I click, but I have no clue of how to select a model when I mouse-pick it. I’m trying to have my modified version of TestBetterCharacter (found in here http://hub.jmonkeyengine.org/forum/topic/rts-unit-selection-and-movement-help-needed/) respond only once I’ve clicked on it. Could anyone help? Also, I’ve made the BetterCharacterControls into an array of 128, and right now I’m using physicsCharacter to test everything, physicsCharacter would be nothing selected.
I am not exactly sure what the question is, so I’ll give it a try:
while ray casting you get a list of collisions.
Select the one you need (most likely the closest)
Then you can find out which spatial / geometry is refered to, by that collision.
[java]Geometry target = collisionObject.getGeometry();[/java]