Closed GoogleCodeExporter closed 9 years ago
[deleted comment]
Ok I found very simple way but I don't sure is it true way.
I use simple math to get x,y position by engle and distance
public float getY(double degree,double distance){
return (float) (Math.sin(Math.toRadians(degree))*distance);
}
public float getX(double degree,double distance){
return (float) (Math.cos(Math.toRadians(degree))*distance);
}
and use it
world.add(objectFactory.newTextObject("3", new Vec(getX(47,5),10,getY(47,5)),
MainActivity.this,getCamera()));
It work for me. Please tell me if have another way.
Thank
Original comment by ooocoke...@gmail.com
on 6 Sep 2011 at 8:40
You can now do it like this:
world.add(objectFactory.newTextObject("3", Vec.rotatedVecInXYPlane(5, 47),
MainActivity.this,getCamera()));
This is how rotatedVecInXYPlane looks like:
public static Vec rotatedVecInXYPlane(float distanceInMeters,double
angleInDegree) {
Vec v = new Vec(distanceInMeters, 0, 0);
v.rotateAroundZAxis(angleInDegree);
return v;
}
And maybe you should change MainActivity.this to myTargetActivity (this might
avoid bugs with the Android UI later)
Original comment by simon.heinen
on 7 Sep 2011 at 11:39
Thakn it work for me.
Original comment by ooocoke...@gmail.com
on 8 Sep 2011 at 2:26
Original issue reported on code.google.com by
ooocoke...@gmail.com
on 6 Sep 2011 at 4:39