≡
Products
▼
Support
▼
Company
▼
Forum
Ambiera Forum
Discussions, Help and Support.
Create a new account
,
Search
, or Login:
Create reply in
How do I get a (sort of) absolute vertex position?
Posted by:
(you are not logged in)
Enter the missing letter in: "In?ernational"
(you are not logged in)
Text:
[quote][b]dekon_17[/b] wrote: Some time age, I've posted here about the weird problem with light mapping in CopperCube. As it turned out, the problem was the... rotation. I could use the Blender lightmapping, but nah, it is terrible idea (if I need to place some stuff around the map, I would need to create props in the level geometry file, and I don't want to mess with a lot of stuff in Blender, this is kinda complicated). Another way was to create a few instances of models with different rotations (in Blender, yet again), but hey, should I say why is this idea bad? And now, there's only two possible solutions that I have, both in CopperCube. The first one is to place a plane mesh with no rotation, and then using "Merge selected mesh into another mesh" add a rotated model geometry to this plane mesh, and then delete plane mesh using polygon editing. Sounds terrible, isn't it? The second way is the plugin! Yeah, I kinda built a plugin for this purpose. Despite the fact that it works... It doesn't works at the same time. Yes, it saves the mesh vertex position, but these are like, a local ones? So, rotation doesn't really affect the positions. Now's the question (that you've seen in the thread title probably), how can I get a position of vertex, but taking into account the mesh rotation? Here's the initial plugin code (that does nothing to geometry, but rotates the mesh to 0 degrees): [code]function RotationCorrection() { var Array = []; var Node = editorGetSelectedSceneNode (); var Buffers = ccbGetSceneNodeMeshBufferCount (Node); if (Buffers == 0) alert ("Ayo, what the ****?"); else { for (var b = 0; b < Buffers; ++b) { var Verticies = ccbGetMeshBufferVertexCount (Node, b); for (var v = 0; v < Verticies; ++v) { var Pos = ccbGetMeshBufferVertexPosition (Node, b, v); Array.push (Pos); } } ccbUpdateSceneNodeBoundingBox (Node); } ccbSetSceneNodeProperty (Node, "Rotation", 0, 0, 0); if (Buffers == 0) alert ("Ayo, what the ****?"); else { for (var b = 0; b < Buffers; ++b) { var Verticies = ccbGetMeshBufferVertexCount (Node, b); for (var v = 0; v < Verticies; ++v) { ccbSetMeshBufferVertexPosition (Node, b, v, Array [v]); } } ccbUpdateSceneNodeBoundingBox (Node); } } editorRegisterMenuEntry ("RotationCorrection();", "Freeze rotation of object");[/code] And here's the example of this broken light mapping: [img]https://i.postimg.cc/85sn0wDz/image.png[/img] The left flag (with propper lighting) was edited with the first engine method I mentioned earlier, and the right one (with wrong lighting) is not edited.[/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