Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: stodorany on September 17, 2013, 12:42:31 PM
-
Hello playmaker Community,
I have two balls in my game.I attached colliders and rigid bodies to both balls. I would like to be able to touch each ball and move it to hit the other ball. Currently i am able to move the ball but when i hover over the other ball it simply goes through the ball and doesn't move the ball.
THis is my Fsm FLow
State 1 ( touch object event) > State 2 (Get Touch Info / screen to world point / set position)
Currently when i touch the ball and move the ball through the screen and end the touch by moving my finger from screen, the ball still remains selected and doesnt fall back to the ground. I Would like the ball to fall to the ground and also to be able to collide with the other ball when selected. I hope someone can help me.
(http://)
-
attach rigidbody and collider on them?
oh didnt read that you already did that... well yes is kinematic has to be unchecked too...
-
Do either have IsKinematic checked? Both have Mass set to not zero? Use Gravity on? Scale of scene non-astronomical? Wearing your lucky shirt?
Typically when using direct transform changes and mixing it with physics you can get some weird results. The transform will override the physics. Also, if two rigidbodies overlap (due to a forced position change) then they will freeze and not respond to physics input.
-
Do either have IsKinematic checked? Both have Mass set to not zero? Use Gravity on? Scale of scene non-astronomical? Wearing your lucky shirt?
Typically when using direct transform changes and mixing it with physics you can get some weird results. The transform will override the physics. Also, if two rigidbodies overlap (due to a forced position change) then they will freeze and not respond to physics input.
Thanks for the respose. I have is kinematic for both objects off. Both masses are set to 1. Both of the gravity is on. the scene is set to 1280 x 720 and also is the background plane. My lucky shirt is tucked away in my wardrobe. Should i wear it now? hehe. Lane, I agree with you that forced position change may be freezing the physics response. I would like to know how else i can give have this sort of touch screen functionality over my objects without manually overriding their physics if possible. I was wondering if we could use a raycast to check for collision or maybe we can use "collision event, wake All Rigid Bodies or use gravity" actions.
-
[EDIT: After testing, the following guess is completely wrong. Don't pay any attention to it.]
This is just a guess...
I'm looking at the code for SetPosition and it uses transform.position. I believe for Physics to be properly implemented during a move, rigidbody.position should be used instead.
This is kind of weird for the playMaker FSM because it runs on the Update() cycle, but it is suggested that the rigidbody.position be changed on the FixedUpdate() cycle.
-
This is just a guess...
I'm looking at the code for SetPosition and it uses transform.position. I believe for Physics to be properly implemented during a move, rigidbody.position should be used instead.
This is kind of weird for the playMaker FSM because it runs on the Update() cycle, but it is suggested that the rigidbody.position be changed on the FixedUpdate() cycle.
Thanks Gary Smith for your input. I get the general idea. Ive had a look at the script. And i do see the transform.position. Since the rigid body is attached to the gameobject, doesnt it get moved along with the transform.position of the object? Have you had any success with rigidbody.position?
-
Hello!
Please ignore that. My guess is wrong. >.> I'm doing some tests now and I get collisions detected even if I use transform.position.
So what else could it be... does one of your colliders have "Is Trigger" checked?
-
Hello,
Can you please give me some details of what you have done or how you were able to achieve this.
Please give me a breakdown of your fsm also. this is mine
State 1 ( touch object event) > State 2 (Get Touch Info / screen to world point / set position)
Are you using the set position action? All is triggers are set to off on my objects.
-
Maybe the Screen to World Point is setting one of the balls in front of or behind the other? I'm not too sure what the issue could be...
-
Maybe the Screen to World Point is setting one of the balls in front of or behind the other? I'm not too sure what the issue could be...
Were you able to drag one of the objects into collision with the other successfully?
My screen to world has Z axis disabled so i doubt it will be sent in front of the object.
-
Hello!!!
Okay, so I set up a similar project, I show the ball moving around, then I was having the same issue you were having!
In my case it was because the project I was working on, in the Physics Settings, the default layer didn't interact with the default layer. Thus there were no interactions between the two balls.
Maybe that's your problem?
-
Hello!!!
Okay, so I set up a similar project, I show the ball moving around, then I was having the same issue you were having!
In my case it was because the project I was working on, in the Physics Settings, the default layer didn't interact with the default layer. Thus there were no interactions between the two balls.
Maybe that's your problem?
Hey,
I have the Default/Default layer ticked in the layer collisions matrix. I actually have all layers ticked. Were you able to solve the issue?
-
I set up a similar playMaker FSM as you described and was able to get one ball to collide with the other. I think at this point you need to send a copy of your project for troubleshooting.
-
Ok it seems my issue has been solved. There was sort of a bug between uni2d and playmaker. But after closing the project, reimporting both assets all seems to be going well. Thanks to all posters for your support especially GarySmith for letting me know that everything worked well on his end and this was not a playmaker problem.