Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperLicht
Various questions of how to work with the engine.

sp2012
Registered User
Quote
2012-10-13 23:17:45

Hello,

I am new to the engine. I want to use the Copperlicht engine and CopperCube to tranform my 2D javascript game into a 3D game.

But I have no idea of how to do collition detection between a model or object and the camera, also how to prevent the player from moving once the collition happened, also in the demos the models of humans are not solid, why is that? I can pass through them. Also, how do I identify models with variables, so I can call javascript code to set their statistics like health or to remove them from the scene once they die, and how do I remove them from the scene? Finally, how do I respawn a model after he died after a while? And how can I display an animation or an image, when the player does something, like swinging his sword at an enemy?

best regards,

sp2012


erik
Registered User
Quote
2012-10-14 21:48:59

You can use getTransformedBoundingBox() of each object, and use intersectsWithBox() of that with the other box, to see if there is a collision at all. If you want automatic collision detection like physics engines do with moving objects, then you need to work around this somehow, CopperLicht doesn't support something like this. AFAIK, running a real solid body physics engine in JavaScript is a bit too slow.

Identifying objects with variables: You can either add any variable to any objects (like yourNode.yourVariable = "something") and that's it. It's JavaScript, and everything is dynamic. Alternatively, all nodes have names and ids. You can identify them using that.

Removing from the scene: Use removeChild() from the parent node.


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Interna?ional" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






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