![Smile :)](./images/smilies/icon_e_smile.gif)
In the collision, i simply skip the next collision and then take the one after
![Smile :)](./images/smilies/icon_e_smile.gif)
I will try setup a demo over the next few days if time is available.
SolarPortal wrote:In the collision, i simply skip the next collision and then take the one after
I will try setup a demo over the next few days if time is available.
obj = 0;
wpID = 0;
hit = 0;
function onInit(objID)
obj = objID;
wpID = sky.getVar("wpID");
end
function onTrigger_Enter(HitID)
tagname = entity.getTagFromID(HitID);
if (tagname == "player") then
hit = hit + 1;
end
if (hit == 1) then
-- set global variables
sky.setVar("Collision",1);
sky.setVar("waypointID",wpID);
sky.lprint("Waypoint: "..wpID);
end
if (hit > 1) then
hit = 0;
end
end
function onUpdate( td )
-- set global variables
sky.setVar("Collision",0);
end
Failed to remove rigidbody as the id does not exist.
It appears when I stop the game, repeated 58 times, which is the number of triggers I create in runtime. Do you know why I get this?
-- Create the waypoints
for i=0,lastNode,5 do
wpx,wpy,wpz = path.getNodePosition(pathName, i)
nodeYaw = path.getNodeYaw(pathName, i)
waypoint[i] = entity.spawn("MR_node",wpx,wpy,wpz,75,20,0.01)
entity.setVisible(waypoint[i],0)
entity.setRotation(waypoint[i],0,nodeYaw,0)
if (i == 0) then
entity.setMaterialName(waypoint[i], "MR_node_red")
end
physics.addTrigger(waypoint[i],1)
sky.setVar("wpID",i/5) --set global var for each script
entity.addScript(waypoint[i],"MR_race_trigger.lua")
end
obj = 0
wp_ID = 0
hit = 0
function onInit(objID)
obj = objID
-- get global variable
wp_ID = sky.getVar("wpID")
end
function onUpdate( td )
-- set global variable
sky.setVar("waypointCollision",0)
end
function onTrigger_Enter(HitID)
tagname = entity.getTagFromID(HitID)
if (tagname == "player") then
hit = hit + 1
end
if (hit == 1) then
-- set global variables
sky.setVar("waypointCollision",1)
sky.setVar("waypointID",wp_ID)
sky.lprint("Waypoint: "..wp_ID)
end
if (hit > 1) then
hit = 0
end
end
SolarPortal wrote:Q) Are you using the physics.removeBody().
SolarPortal wrote:With the last version, there was changes to the action "PhysX Trigger Volume", so i can do some test myself with this
function onTrigger_Enter(int hitID)
sound.play2DSound( sound_ID );
end
StarFire wrote:Looking forward to the new gen2 version racer, bet its going to be awesome
You bet it! I'm using the best engine ever created.
physics.addTrigger(waypoint[i],1)
I really enjoy the engine.![]()
Users browsing this forum: No registered users and 1 guest