Ambiera Forum

Discussions, Help and Support.

Create a new account, Search, or Login:
Name: Password:
Ambiera Forum > CopperCube > Help with CopperCube
physics simulation enabled then node delete but collision remain
Author Text

Registered User
2022-06-30 21:38:21


I enabled physics simulation for my game then when I delete a node, I can still collide with it even when the node disappeared. I searched a little in the forum and saw a fix for this problem is to use ccbUpdatePhysicsGeometry( ).

I would like to know if I do things correctly, I just have to execute javascript every seconds, and I just add the command: ccbUpdatePhysicsGeometry( ) ?

I have to just paste this command and nothing else, or do I have to add something basic around it?

thanks in advance.

2022-06-30 22:13:01

You need to pass a command to update the physics geometry every time you move something when physics is enabled.

Registered User
2022-06-30 22:49:04

I use the command ccbUpdatePhysicsGeometry( ) in javascript. I did it on the scen root node , every 10ms ,execute the javascript command ccbUpdatePhysicsGeometry( ).

It is the right way to do it? At least it does solve my problem but will it cause other problem?

2022-07-04 09:15:09

Glad it's working! No, I don't recommend doing it every 10ms for 2 reasons...

1- If you have "many" call events like that, it "can" end up slowing your game down.

2- Using a short delay such as 10ms will use up more resources on slower processors.

Don't be afraid of using "every few seconds" events, but It's best to do a single update immediately after the event whenever you can and save the every few seconds for things that need constant updates. If the game starts to crawl after a lot of development, you can increase the times from 10ms to 30, 50,70,100 etc and it may improve the run-speed of the game.

Personally I use every few seconds extensively, I usually have many events running like this but while the games run on my machine, they tend to struggle and run slow on other machines - so I'm learning to use it less often when possible.

If it works, it's fine - if you run into problems in the future, try adjusting it to single events instead of every few milli-seconds.

Registered User
2022-07-04 13:46:08

Thanks again VP, very usefull!!

Create reply:

Posted by: (you are not logged in)

Enter the missing letter in: "Int?rnational" (you are not logged in)




Possible Codes

Feature Code
Link [url] [/url]
Bold [b]bold text[/b]
Image [img][/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]



Copyright© 2020 Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact