≡
Products
▼
Support
▼
Company
▼
Forum
Ambiera Forum
Discussions, Help and Support.
Create a new account
,
Search
, or Login:
Create reply in
Script Snap to grid
Posted by:
(you are not logged in)
Enter the missing letter in: "Int?rnational"
(you are not logged in)
Text:
[quote][b][/b] wrote: I added a command to enter the value you want. So there is no need to change every time the script. I left the default value of 5. [code]function snap(value, gridSize, roundFunction){ if (roundFunction === undefined) roundFunction = Math.round; return gridSize * roundFunction(value / gridSize); } function doSnapSceneNode() { var s = editorGetSelectedSceneNode(); var position = ccbGetSceneNodeProperty(s, "Position"); var grid = prompt("insert value GridSize",5); var moveobjX = snap(position.x,grid); var moveobjY = snap(position.y,grid); var moveobjZ = snap(position.z,grid); ccbSetSceneNodeProperty(s,"Position",moveobjX,moveobjY,moveobjZ); ccbUpdateSceneNodeBoundingBox(s); editorUpdateAllWindows(); } editorRegisterMenuEntry("doSnapSceneNode()", "Snap to grid\tCtrl+M"); [/code][/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