I am loading a proxy in my main collection.In this game collection I have a PLAYER and spawner having DISC game object.
I have disc and player as kinematic collisionobject
Since, its a proxy I have
local function physics_world_listener(self, event, data)
if event == hash("contact_point_event") then
-- Handle detailed contact point data
pprint(data)
elseif event == hash("collision_event") then
-- Handle general collision data
pprint(data)
elseif event == hash("trigger_event") then
-- Handle trigger interaction data
pprint(data)
elseif event == hash("ray_cast_response") then
-- Handle raycast hit data
pprint(data)
elseif event == hash("ray_cast_missed") then
-- Handle raycast miss data
pprint(data)
end
end
function init(self)
physics.set_listener(physics_world_listener)
in both of my disc and player script.
But I am getting no contact point response no logs, it just passes through like above picture.
Am I doing something wrong I have checked the z through logs.
Anyone ?? Please pitch in to help a beginner. This is becoming a big blocker for me to move forward.
Are you sure the listener is being set? E.g:
function init(self)
print("setting listener")
physics.set_listener(physics_world_listener)
end
That would be my first thing to check.
Oh another thing is you mention setting the listener on both player and disc. Per the documentation I think it is one listener per world.
If you’re looking for both objects to receive collision messages, then you should just not set a listener and instead receive the collision messages in on_message.
3 Likes
But my game collection is a proxy thats why.
How do I go about one listener as the function accepts event, self,data args; Is it OK being used as a module.
I think you must be confused. Proxies do not necessitate the use of the physics event listener. Where did you pick that up?
I was doing it without a world listner. But wasn’t still able to listen anything through on_message.
Defold documentation on physics world says
Setting the Physics World Listener
In Defold, each collection proxy creates its own separate physics world. Therefore, when you are working with multiple collection proxies, it’s essential to manage the distinct physics worlds associated with each. To ensure that physics events are handled correctly in each world, you must set a physics world listener specifically for each collection proxy’s world.
I would drop the event listener for now until you’ve got the basics working.
I would then ensure that the player and disc are in the same collection, have the appropriate collision objects (player on player and disc on disc), and in their on_message I would just put:
print(message_id)
That way you’ll see exactly what’s coming in (if anything).
1 Like
function on_message(self, message_id, message, sender)
pprint(message_id,message)
end
I do it like this , my screenshots are shared which shows all properties, I am not getting ANY LOGS.
Yes, this is true if you want to use a listener. But you don’t have to.
How am I supposed to know you did that already?
Easiest way is probably for you to zip up your project and upload it here.
1 Like
Archive.zip (2.3 MB)
I appreciate your help.
Just to inform I also tried checking the z coordinates. setting it 0 and 1, but didn’t work. Thanks I truly appreciate your help.
Did I miss something important @ Alex_8BitSkull???
Not sure what’s going on. All I did was create actual collision object components in the assets pane and it works (as opposed to creating a temporary one in the game object outline view).
Very strange, maybe a bug?
kinematics.zip (456.5 KB)
Followed the lead. Deleted collision object , re applied again and it worked. Maybe a bug after all. Thanx for trying.
1 Like
An idea: with mysterious bugs, if you still have a copy of the files that produce the error, it could be worth contrasting the text contents of the Defold collections/GOs/components before & after it worked. A bug may reveal itself there.