Custom Poly Defining
by Pete111 · in Torque Game Builder · 03/01/2005 (7:13 am) · 5 replies
Can someone give me a short tutorial/example on setting up the custom polygons for sprites?
I'm not understanding the -1 to 1 range??? Is this a percentage of distance from center of sprite to vertex point?
Thanks!
I'm not understanding the -1 to 1 range??? Is this a percentage of distance from center of sprite to vertex point?
Thanks!
About the author
#2
03/01/2005 (7:22 am)
Anthony: I'll take a look at your code and see what's going on... hmm maybe I'll go make a quick little visual editor.
#3
03/01/2005 (9:31 am)
Cool, I can't wait till some more milestones are complete.
#4
Just to explain a little though; the -1 to +1 range is a local-space or normalised range. (-1,-1) equates to the top/left and (+1,+1) equates to the bottom/right. Why this system? Well, the reason is that it's independant of size. If you scale your objects, the positions are still valid. This coordinate system is used for both the collision-polygon and the mount/link points. The difference with the mount/link-points is that you can exceed -1 or +1 so that you can mount outside the bounding-box (size) of the object, exactly as the "helpers" in the shooter demo.
- Melv.
03/01/2005 (10:03 am)
Yeah, defining custom polygons is quite brutal at the moment but with editor support, it'll be dead simple.Just to explain a little though; the -1 to +1 range is a local-space or normalised range. (-1,-1) equates to the top/left and (+1,+1) equates to the bottom/right. Why this system? Well, the reason is that it's independant of size. If you scale your objects, the positions are still valid. This coordinate system is used for both the collision-polygon and the mount/link points. The difference with the mount/link-points is that you can exceed -1 or +1 so that you can mount outside the bounding-box (size) of the object, exactly as the "helpers" in the shooter demo.
- Melv.
#5
03/01/2005 (6:01 pm)
So you guys know, this'll be the next editor we do. And Anthony's tool is a pretty nice stop-gap in the mean time. :)
Associate Anthony Rosenbaum
1) open up an image
2) make note of all the coords you will need to create a convex shape for collision (right down each points X/Y pair)
3) use my Javascript converter to generate those points in a -1 to 1 range