Re: DT in BGT

You could have the game determine who is "player1" and "player2", and actually position them differently, but that'd probably be more arduous than just mirroring. I'm actually not too well versed in this, although it should be simple.
Ex, to mirror a vector across the origin, effectively rotating 180degrees, you just multiply by negative 1. I found out yesterday that BGT's vectors lack an OpNeg method, and that somehow doesn't just resolve to multiplying by -1, so this would require -1*v, where v is the vector.
Mirroring over a specific axis is a bit more complex, by which I mean I manage to screw it up in spite of it not being that complex. If you work with vectors, just multiply the value for that axis by -1. If you want to mirror theta, I can never remember the correct way and have to rederive it every time I need it. Ex, to mirror across the x axis, you'd set theta = 2*pi-theta. Y is more troublesome. Like, I think pi-theta works, and sine/cosine shouldn't care if theta is between 0 and 2pi, but if you need theta to be between 0 and 2pi, you can either say if (theta < 0) theta += 2pi, or just say theta = (3pi - theta) % 2pi.
And I have no idea if any of that does what you need. Strictly speaking, you have an affine transform that translates and scales. And affine transforms are kinda confusing.
To try and make this more useful: is the net on or parallel to one of the axes? And how far apart are the players? I think applying those axis flips, then adding the distance, should get the job done. So if the net is on the y axis, and the players are 10m apart, x-wise, I'd try something like:
void mirror (ball@ b) {
  b.theta = (3pi - b.theta) % 2pi;
b.vel.y *= -1
b.position.x += 10;
// if y needs to be mirrored on the ball's position, b.position.y *= -1, assuming that the center of the court is at y=0.
}
I feel like this was a confusing mess of a post. hmm Hopefully there's something useful here?

-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : JLove via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : JLove via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : JLove via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : JLove via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : JLove via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : JLove via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : JLove via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : JLove via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : JLove via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : JLove via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : JLove via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : JLove via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : JLove via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : JLove via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : JLove via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : JLove via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : JLove via Audiogames-reflector

Reply via email to