Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
Hi niko. Thanks for your quick reply on my previous post.It worked.But i think there is a bug in gotoSceneByName(scene, ignorecase) .Have a look at it.Now i want to ask you if you can post a tutorial or give me an example on how to move an object with the mouse.Let us say that we have two cubes and we want to select and move the one cube with the mouse(Scenenode position will be mouse coordinates).And If it's possible can you include collision detection when the box that is moving is colliding with the other? And another question.Is it possible an Animator to return the scenenode that is attached to? Thanks in advance. |
||||
|
What exactly is the bug you mention in gotoSceneByName? What happens? About moving the mouse: You'll have to write this yourself, simply react to the mouse event, test what object is under it using CopperLichts collision detection, and move it accordingly. There are even several methods in CopperLicht to get the 2D position from a 3D position and the other way round, so it should be pretty easy. I don't think I can write a specific tutorial for exactly this case. Animators don't store the scene node they are attached to, so this is currently not possible, but there is nothing preventing you from storing this in the animator yourself. |
||||
|
Ok i will try it. The bug in the engine.gotoSceneByName('somescene', true or false) is that it's not working.It's not switching to the "somescene'.I tried with two scenes that i created in coppercube and the engine is started with var engine =startCopperLichtFromFile('3darea','copperlichtdata/test.ccbjs'); Now can you please help me with what is wrong on the following code and i'ts not working?The mesh is an inserted static mesh inside coppercube. var Scenes = engine.getScenes(); engine.gotoScene(Scenes[1]); var newscene = engine.getScene(); var MyMesh = newscene.getSceneNodeFromName('Base7225').getMesh(); if (MyMesh) { alert ("Gotit");//This screen message is working so the MyMesh Exists var BBox = MyMesh.getBoundingBox(); if (BBox) {alert ("OK");}//This screen message is not working so the BBox dosen't Exists var meshBuffer = MyMesh.GetMeshBuffers(); if (meshBuffer) { for (var j = 0; j < meshBuffer.length; j++) { var BufVertices = meshBuffer[j].Vertices; for (var k = 0; k < BufVertices.length; k++) { var VertexPos = BufVertices[k].Pos.X; // if i put an alert here it will bring me the Pos.X if (VertexPos > 0) {VertexPos = VertexPos + 100}; if (VertexPos < 0) {VertexPos = VertexPos - 100}; } } meshBuffer[j].update ; meshBuffer[j].recalculateBoundingBox(); } } Thanks and sorry if i make you feel dizziness but as i told you i am not e very good developer ![]() |
||||
|
Never mind that solve it but now how am i going to update the scenenode bounding box because when i print it it's not updated. Thanks again |
||||
|
ok :) |
|