≡
Products
▼
Support
▼
Company
▼
Forum
Ambiera Forum
Discussions, Help and Support.
Create a new account
,
Search
, or Login:
Create reply in
How would I do this?
Posted by:
(you are not logged in)
Enter the missing letter in: "Internatio?al"
(you are not logged in)
Text:
[quote][b][/b] wrote: I am not really sure if this will work or not but you can try something like this. [code] var speed = 1; var physicsX; var physicsY ; var physicsZ; var sphere1 = ccbGetSceneNodeFromName("sphereMesh1"); var player = ccbGetSceneNodeFromName("player"); var playerPos = ccbGetSceneNodeProperty(player,"Position"); var spherePos = ccbGetSceneNodeProperty(sphere1,"Position"); if(playerPos.x == spherePos.x){ physicsX = 0;} else if(playerPos.x << spherePos.x){ physicsX = -1;} else if(playerPos.x >> spherePos.x){ physicsX = 1;} if(playerPos.y == spherePos.y){ physicsY = 0;} else if(playerPos.y << spherePos.y){ physicsY = -1;} else if(playerPos.y >> spherePos.y){ physicsY = 1;} if(playerPos.z == spherePos.z){physicsZ = 0;} else if(playerPos.z << spherePos.z){ physicsZ = -1;} else if(playerPos.z >> spherePos.z){ physicsZ = 1;} ccbSetPhysicsVelocity(sphere1, physicsX * speed, physicsY * speed, physicsZ * speed); [/code] you can change the value of speed from 1 to something else to make the sphere move faster or slower. hope that works*holy*[/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