I am finding Gideros Studio nice and simple except for the physics stuff. For example I had the issue with the revolute joints earlier which was answered and now I am am having issues setting an object as a sensor.
The one thing I would ask for is more information on putting together physics based games. I understand that I need to create a fixture which is done but when setting the object as a sensor it always returns nil.
Why cant I just say "thisBody:setSensor(true) and it just work?
Cheers from the thick one.
Mike
Comments
You can set isSensor field as true while creating fixture definition table like:
Thanks for the fast help.
Mike
http://www.sharksoupstudios.com
I have basically a square, with an opening, and the sensor is in the centre, when I hist the box with my character the onBeginContact is triggered, but the bodyA or B name is the object name, rather than the individual sensor, whats the trick to see if the sensor has been triggered?
---------------------------------------
Well, for that you need to add name to fixture A and fixture B instead.
{code}
["window"] = {
anchorPoint = { 0.498, 0.018}, fixtures = {
{
pe_fixture_id = "home", density = 2, friction = 0, restitution = 0, sensor=true,
filter = { categoryBits = 1, maskBits = 65535, groupIndex = 0 },
shape = { 75.9999995, 100.00000028 , 69.9999995, 215.00000028 , -70.0000005, 214.00000028 , -78.0000005, 96.00000028 }
}
{
pe_fixture_id = "frame", density = 2, friction = 0, restitution = 0, sensor=false,
filter = { categoryBits = 1, maskBits = 65535, groupIndex = 0 },
shape = { -80.0000005, 103.00000028 , -76.0000005, 245.00000028 , -119.0000005, 271.00000028 , -133.0000005, 65.00000028 }
}
{
pe_fixture_id = "frame", density = 2, friction = 0, restitution = 0, sensor=false,
filter = { categoryBits = 1, maskBits = 65535, groupIndex = 0 },
shape = { 118.9999995, 269.00000028 , 73.9999995, 243.00000028 , 80.9999995, 97.00000028 , 134.9999995, 70.00000028 }
}
{
pe_fixture_id = "", density = 2, friction = 0, restitution = 0, sensor=false,
filter = { categoryBits = 1, maskBits = 65535, groupIndex = 0 },
shape = { -125.0000005, 71.00000028 , 0.999999500000001, 1.00000027999999 , 122.9999995, 72.00000028 }
}
}
} {/code}
And the called code is as follows:
{code}
local fixtureA = e.fixtureA
local fixtureB = e.fixtureB
local bodyA = fixtureA:getBody()
local bodyB = fixtureB:getBody()
if bodyA.name then
print("a:"..bodyA.name)
end
if bodyB.name then
print("b:"..bodyB.name)
end
{/code}
Ideas?
---------------------------------------