Contact point in local 2d face co-ordinates
Posted: Fri Dec 09, 2011 1:39 pm
Hi, first up, great work on the physics engine Norbo, it's great - I've used it in a few things of my own recently and it's proven to be really useful.
Now onto my question:
At the moment I'm creating a procedural 'shatter' effect for a pane of glass. I have done the maths for this part in 2d, as it seemed to make sense to me to do it that way (the problem is mainly a 2d one that just needs extruding). I pass my convex hull generator the face dimensions (assumed to be rectangular/square), and the and the shatter point of impact. Then it performs calculations, extrudes into 3d prisms and returns a load of 3d ConvexHulls.
I want to allow the user to pick through the screen into the face of the cuboid (the pane) and then get a) the face dimensions as a 2d rectangle, and b) the ray intersection position in cuboid face co-ordinates. My description isn't great so I'll give an example. Say I have a square pane with dimensions [X=512, Y=512, Z=4] and someone clicks directly in the centre of this pane. The co-ordinate i want back would be (X=255.5, Y=255.5). It happens that my origin in that co-ordinate space is the top left corner, but if that's not what I need I could possibly alter that (although I would rather not, since it would mean re-doing the maths since I derived the trigonometry equations working in that co-ordinate space).
As well as being able to this with a ray, it would be neat if I could also get this point of impact mentioned above from collisions with other objects too. I would imagine this has something to do with setting an event handler for ContactCreated?
Either way, I'm a bit puzzled over this whole problem, so I thought I'd ask for some input.
Thanks in advance,
RH
Now onto my question:
At the moment I'm creating a procedural 'shatter' effect for a pane of glass. I have done the maths for this part in 2d, as it seemed to make sense to me to do it that way (the problem is mainly a 2d one that just needs extruding). I pass my convex hull generator the face dimensions (assumed to be rectangular/square), and the and the shatter point of impact. Then it performs calculations, extrudes into 3d prisms and returns a load of 3d ConvexHulls.
I want to allow the user to pick through the screen into the face of the cuboid (the pane) and then get a) the face dimensions as a 2d rectangle, and b) the ray intersection position in cuboid face co-ordinates. My description isn't great so I'll give an example. Say I have a square pane with dimensions [X=512, Y=512, Z=4] and someone clicks directly in the centre of this pane. The co-ordinate i want back would be (X=255.5, Y=255.5). It happens that my origin in that co-ordinate space is the top left corner, but if that's not what I need I could possibly alter that (although I would rather not, since it would mean re-doing the maths since I derived the trigonometry equations working in that co-ordinate space).
As well as being able to this with a ray, it would be neat if I could also get this point of impact mentioned above from collisions with other objects too. I would imagine this has something to do with setting an event handler for ContactCreated?
Either way, I'm a bit puzzled over this whole problem, so I thought I'd ask for some input.
Thanks in advance,
RH