16
Bug Reports & Support / Shield.getfacing?[Solved]
« on: January 06, 2016, 12:48:37 PM »
EDIT: Just fail radian/degree, because facing is a degree, script is an radian, sorry. You can delete this subject? Thank!
Except if i am very bad, but when you request facing of your shield, he is center of your shield no?(Facing is a angle)
(Do not look projectile, just look yellow explosions)
Why so when i use this value with math, my explosion follow my RIGHT and LEFT arrow:
This is for a shield project. I need than explosions spawn only on shield, so i have arc of shield for calculate and facing of shield, but if facing is not functionnal... except if he link with facing of ship, but without javadoc, it is very hard for have correct value... with a front shield, shield facing is equal with ship facing. But ship facing give same results ><
Positions exact for me for facing ship: But not for game. (Or just not for player ship.)
My first question: Why ship/shield facing is linked with right/left arrow, it is not face of ship or shield, normally?
My second question: How i can have facing of a shield(for calculate positions)?
Thank!
EDIT: Getfacing give good "facing" for my projectile, but not for others, what the... why my projectile have always facing 90? (when i do not move MY MOUSE) and my explosions NAWAK EXCEPT 90?. Why link mouse with facing ship? ><
Except if i am very bad, but when you request facing of your shield, he is center of your shield no?(Facing is a angle)
(Do not look projectile, just look yellow explosions)
Why so when i use this value with math, my explosion follow my RIGHT and LEFT arrow:
Spoiler
[close]
This is for a shield project. I need than explosions spawn only on shield, so i have arc of shield for calculate and facing of shield, but if facing is not functionnal... except if he link with facing of ship, but without javadoc, it is very hard for have correct value... with a front shield, shield facing is equal with ship facing. But ship facing give same results ><
Positions exact for me for facing ship: But not for game. (Or just not for player ship.)
Spoiler
Each frame:
Quote
float pX = Shield.getLocation().getX();
float pY = Shield.getLocation().getY();
float range = Shield.getRadius();
float arc = Shield.getArc(); // no use
float facing = Shield.getFacing(); // My problem, he save my move mouse, not facing
float angleco = range * (float) Math.cos(facing) ; // explosion normally always on head of my ship(because, we cannot turn this shield)
float anglesi = range * (float) Math.sin(facing) ;
Vector2f positio = new Vector2f(pX + angleco,pY + anglesi);
engine.spawnExplosion(positio, ZERO, Color.yellow, 100, 0.5f);
interval.advance(amount);
if (interval.intervalElapsed()) {
for(int i = 1; i <= 3; i++){
float facingproj = Shield.getFacing();
float anglecos = range * (float) Math.cos(i*45) ;
float anglesin = range * (float) Math.sin(i*45) ;
Vector2f position = new Vector2f(pX + anglecos,pY + anglesin);
engine.spawnExplosion(position, ZERO, Color.red, 100, 0.5f); // random position if i move my mouse(my shield do not turn)
engine.spawnProjectile(shipshield, null,"Noir_mortir",position,facingproj, null); // This facingproj is good, he do not follow my mouse, what???
}
}
[close]
My first question: Why ship/shield facing is linked with right/left arrow, it is not face of ship or shield, normally?
My second question: How i can have facing of a shield(for calculate positions)?
Thank!
EDIT: Getfacing give good "facing" for my projectile, but not for others, what the... why my projectile have always facing 90? (when i do not move MY MOUSE) and my explosions NAWAK EXCEPT 90?. Why link mouse with facing ship? ><