≡
Products
▼
Support
▼
Company
▼
Forum
Ambiera Forum
Discussions, Help and Support.
Create a new account
,
Search
, or Login:
Create reply in
I need help detecting collisions with custom scene nodes. I put a custom node in an official tutorial and it's not solid.
Posted by:
(you are not logged in)
Enter the missing letter in: "Intern?tional"
(you are not logged in)
Text:
[quote][b]wild-master[/b] wrote: I followed this official tutorial: [url]https://ambiera.com/copperlicht/documentation/tutorials/tutorial-06.html[/url] The live demo from that page is included with the source code of CopperLicht, so I added the included custom node from the "[b]cubescenenode.js[/b]" file of the source to the demo. I added the Cube node, but the First-Person Camera character walks through it. I added the cube like this: [code][b]var cubenode = new CL3D.CubeSceneNode(); scene.getRootSceneNode().addChild(cubenode); newposition = new CL3D.Vect3d(-50,100,20); cubenode.Pos = newposition;[/b][/code] The tutorial linked above says this: [quote][b]"CopperLicht automatically provides a triangle selector for all geometry where the 'Collision' attribute was checked in the editor via scene.getCollisionGeometry(), so you won't have to build it yourself.[/b]"[/quote] If I plan to always create my own custom nodes without the aid of CopperCube, just for fun, I won't be able to activate the "[b]Collision[/b]" attribute because the node won't ever be in CopperCube first. For that situation, the demo says I should use the "[b]MeshTriangleSelector()[/b]" and "[b]OctTreeTriangleSelector()[/b]" features. The tutorial above says this: [quote]"[b]We could have also supplied some other collision geometry represented as TriangleSelector. Triangle selectors in CopperLicht simply provide a way to access geometry. If you have a Mesh for example, you can create a new triangle selector using new MeshTriangleSelector(yourMesh, yourSceneNode);. If the mesh is big, you could use new OctTreeTriangleSelector(yourMesh, yourSceneNode) instead to speed up the collision queries a bit.[/b]"[/quote] I tried adding this line at many spots of the code: [code][b]new MeshTriangleSelector(cubenode.getMesh(), null, null, cubenode);[/b][/code] That causes all collisions to stop working as a side effect of the whole code being destroyed by that incorrect line, and this error appears in the console of my browser: [code][b]ReferenceError: MeshTriangleSelector is not defined[/b][/code] Please tell me how to use "[b]MeshTriangleSelector()[/b]" and "[b]OctTreeTriangleSelector()[/b]" correctly so I can enable collision detection for nodes that aren't imported from CopperCube. The file "[b]cubescenenode.js[/b]" shows that the Cube is a "[b]CL3D.MeshSceneNode[/b]" with a [b]MeshBuffer[/b] attached, but I don't know how to call the mesh and I don't know how to add it to the collision detection routine of CopperLicht. I surpassed many barriers by myself while practicing CopperLicht because I don't want to be lazy, but this seems to be beyond my current level and I need a boost. I know the benefits of importing all models from CopperCube. I just want to practice by detecting the collision with the custom cube that doesn't have an enabled "Collision" marker because it is created fully with CopperLicht. I know the fear of the employees of Ambiera, but don't worry. Even if I practice for the next five years, and I become so wise that I could switch to CopperLicht exclusively, I will always buy every version of CopperCube to show support and appreciation toward this company, and if I ever become adept with JavaScript, I will graduate by practicing the C++ source that is included with the Professional version, and I will always need to pay you for that, so I'm locked in (willingly!). If I practice for a decade and I feel like I still cannot sufficiently utilize the power of JavaScript, I will traverse the Earth until I tell every living human that I am too stupid. I will fully admit it. I will write it on my tombstone. I will write it on my bones.[/quote]
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