Hi again. This time I'm trying to spawn some mobs around the player under certain conditions. I'm taking the player's position, adding some random X and Z values, and then using that new position spawnPosition as the starting position for the raycastFromWorldPosition() method. Basically I'm trying to find the ground level Y value so that I can spawn a mob at the spawnPosition vector at the correct terrain height. However, no matter what I use as the starting position vector, it only uses the player's position vector.
My vectors look good to start with.
But after the ray cast, the spawn point is off.
I'm guessing another bug? Or, hopefully, I'm missing something obvious in my code and it can be salvaged. Maybe my direction vector is wrong? Any help would be much appreciated.
Vector3f spawnPosition = event.getPlayer().getPosition().add(new Vector3f( ( xPos.nextFloat()*30.0f ) + 20.0f, 0, ( zPos.nextFloat()*30.0f ) + 20.0f ) );
event.getPlayer().sendTextMessage("player Position: " + event.getPlayer().getPosition().toString());