≡
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: "I?ternational"
(you are not logged in)
Text:
[quote][b][/b] wrote: The flag model is the same, except one of them doesn't have rotation. Also, I finally fixed my script... Almost. I mean, it does its job fine now, but it can't handle all the rotations at once (probably my mistake somewhere) and textures are repositioned sometimes. [code]function RotationCorrection () { var Node = editorGetSelectedSceneNode (); var Buffers = ccbGetSceneNodeMeshBufferCount (Node); var Rot = ccbGetSceneNodeProperty (Node, "Rotation"); ccbSetSceneNodeProperty (Node, "Rotation", 0, 0, 0); if (Buffers == 0) alert ("Ayo, what the fuck?"); else { for (var b = 0; b < Buffers; ++b) { var Verticies = ccbGetMeshBufferVertexCount (Node, b); for (var v = 0; v < Verticies; ++v) { var NewPos = new vector3d(0, 0, 0); var Pos = ccbGetMeshBufferVertexPosition (Node, b, v); NewPos.x = Pos.x; NewPos.y = Pos.y * Math.cos(Rot.x * Math.PI / 180) + Pos.z * Math.sin(Rot.x * Math.PI / 180); NewPos.z = -Pos.y * Math.sin(Rot.x * Math.PI / 180) + Pos.z * Math.cos(Rot.x * Math.PI / 180); var Pos = new vector3d(NewPos.x, NewPos.y, NewPos.z); NewPos.x = Pos.x * Math.cos(Rot.y * Math.PI / 180) + Pos.z * Math.sin(Rot.y * Math.PI / 180); NewPos.y = Pos.y; NewPos.z = -Pos.x * Math.sin(Rot.y * Math.PI / 180) + Pos.z * Math.cos(Rot.y * Math.PI / 180); var Pos = new vector3d(NewPos.x, NewPos.y, NewPos.z); NewPos.x = Pos.x * Math.cos(Rot.z * Math.PI / 180) - Pos.y * Math.sin(Rot.z * Math.PI / 180); NewPos.y = Pos.x * Math.sin(Rot.z * Math.PI / 180) + Pos.y * Math.cos(Rot.z * Math.PI / 180); NewPos.z = Pos.z; ccbSetMeshBufferVertexPosition (Node, b, v, NewPos); } } ccbUpdateSceneNodeBoundingBox (Node); } } editorRegisterMenuEntry ("RotationCorrection();", "Freeze rotation of object");[/code] [Edit: it doesn't really fix the lighting, although, it might be because of rotated normals or something][/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