Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: rojosedano on March 07, 2012, 05:29:04 AM
-
Hello, I have two questions:
1-I have difficulties to adjust the point of origin of the ray in action raycast. It always comes from the same point.
2-you can make a custom action with javascript?
thanks
-
How are you determining what your point of origin is? Are you raycasting from a specific camera? From a mouse pointer?
I cast rays via the following code.
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
I can't answer question 2 as I don't use javascript.
-
maybe I have not explained well, sorry for my bad English I am Spanish.
See the attached image.
Ray always goes from the center of the cube.
I do something wrong?
thanks
-
You'd probably want to use a Vector3 variable, store the origin object's transform.position in it with the Transform Get Position action, then use the Vector3 Add action to add an offset. Then use that variable in the raycast action's From Position.
-
You'd probably want to use a Vector3 variable, store the origin object's transform.position in it with the Transform Get Position action, then use the Vector3 Add action to add an offset. Then use that variable in the raycast action's From Position.
But how do I make that vector face same direction as a cube?
-
Hi,
Yes you can write custom actions in javascript, but I recommand c#, you'll then be able to copy paste from all the existing actions and the one on the wiki and forum.
set the fromGameObject to "none" then the position will be taken in consideration, else it's ignored. that's your problem I think.
bye,
Jean