Rotating fxShapeReplicator and fxFoliageReplicator
by Matt Kronyak · in Torque Game Engine Advanced · 12/23/2008 (10:19 pm) · 8 replies
The level designers on my project have been asking me for awhile now if I could get replicator rotation working for TGEA 1.7.1. This isn't an issue that should be specific to any version of Torque but its not something I've had success with yet in the amount of time I've tried to get it working. What they are asking for is the replicators to fill the replication area as it appears in the editor. The elipse that surrounds the replication area correctly rotates but the shapes or foliage inside do not replant themselves into the new area.
I seem to recall that a previous version of Torque, possibly TGE, did have this working. If anyone has this code I would really appreciate getting a copy of it!
I seem to recall that a previous version of Torque, possibly TGE, did have this working. If anyone has this code I would really appreciate getting a copy of it!
#2
Ultimately the issue I'm trying to resolve is figuring out how to factor in the rotation of the replicator to effect the calculations in CreateFoliage (and the fxShapeReplicator equivalent) so that the generated objects are within the bounds of the replication area as it appears in the mission editor.
Enjoy your vacation!
12/24/2008 (4:36 am)
Andy, thanks for the response. I'm aware that TGE and TGEA do their rendering completely differently -- this is not so much a rendering issue as it is a placement issue. I merged in the important two lines of the rectangular replication code for the foliage replicator (the 2 lines where FoliagePosition.x and FoliagePosition.y get their values in CreateFoliage) into the regular fxFoliageRepliactor and made it so that it can be toggled between rectangular or circular placement area. This was another example of where it didn't matter whether it was from TGE or TGEA since the way to determine where things get placed is the same between the two regardless of how they are eventually rendered.Ultimately the issue I'm trying to resolve is figuring out how to factor in the rotation of the replicator to effect the calculations in CreateFoliage (and the fxShapeReplicator equivalent) so that the generated objects are within the bounds of the replication area as it appears in the mission editor.
Enjoy your vacation!
#3
[I sent an email to the email account on your profile.]
12/25/2008 (3:24 pm)
Yes - you are correct - it is a placement, not a rendering issue. I was thinking back to some of the things I tried to get it working which involved changing the rendering a bit. And the final version I ended up with does change the rendering and shader to cut down on a whole lot of unnecessary calls to GFX->setVertexShaderConstF().[I sent an email to the email account on your profile.]
#4
12/25/2008 (6:03 pm)
Andy, I got the email and will check out the code. I'll let you know how it goes.
#5
Thanks again.
12/26/2008 (1:53 am)
Andy, the code you sent me did exactly what I needed to! I ran a test with the full code you sent and it worked great. I ended up merging just what I needed right now (the rotation-related stuff) and it works flawlessly. I'll be sure to add you to the credits of my game. ;)Thanks again.
#6
Can I get a copy of that as well? I have an FXFoliageReplicator that can be toggled to square or oval, and I was thinking about putting up a resource.
12/26/2008 (6:44 am)
@Andy, Matt:Can I get a copy of that as well? I have an FXFoliageReplicator that can be toggled to square or oval, and I was thinking about putting up a resource.
#7
12/26/2008 (8:14 am)
Since I've had several requests, I'll release a resource today and add a link here. I wasn't quite ready to do this, but I also don't want to spend time sending it to a bunch of people individually :-)
Torque Owner asmaloney (Andy)
Default Studio Name
I'm on vacation until mid-Jan and don't think I have any of that stuff with me [my dev laptop died the day before I left on vacation - a sign?], so it'll be a little while...
NOTE: TGE and TGEA do their rendering completely differently, so the TGE code actually doesn't help here.