kriket Posted July 27, 2015 Share Posted July 27, 2015 Say, I have a sprite of a plank and I want to make it see-saw. So I dont want it to translate, just rotate, like any usual see-saw would when a player lands on it. How do I achieve this? Link to comment Share on other sites More sharing options...
icp Posted July 27, 2015 Share Posted July 27, 2015 Apply angularVelocity or use a tween with sprite rotation as parameter. kriket 1 Link to comment Share on other sites More sharing options...
kriket Posted August 3, 2015 Author Share Posted August 3, 2015 I used tween with sprite rotation as parameter but the body collider of see-saw is not moving with the tweening see-saw sprite. So the player can't really interact with this moving see-saw as he just collides with body which is not moving. Do I have to tween the body collider of this see-saw seperately?? Is this standard to tween body collider separately from sprite? Link to comment Share on other sites More sharing options...
icp Posted August 3, 2015 Share Posted August 3, 2015 Which physics engine are you using?Try to use the angularVelocity method as the tween method is applied only to texture. kriket 1 Link to comment Share on other sites More sharing options...
kriket Posted August 3, 2015 Author Share Posted August 3, 2015 I needed to make the player interact with the see-saws, ie when player lands on one end of the see-saw, see-saw rotation reacts accordingly (just like real-world see-saw). The problem is, Player and world are arcade physics enabled, and I reckon P2 on player and world (so basically everywhere), will affect performance a lot. I am targetting mobile, and its a platformer with a few things going on in the scene. Will try to fake the "interactivity" with AngularVelocity and see how far I go. Thanks a lot for all the help and putting me in the right direction. Link to comment Share on other sites More sharing options...
kriket Posted August 3, 2015 Author Share Posted August 3, 2015 I can obviously set.achor.to(0.5,0.5) and do something like this "sprite.body.angularVelocity = -200;", but any ideas on how to achieve "interactivity"? depending on where the player lands on the see-saw (like in real-world)? Link to comment Share on other sites More sharing options...
icp Posted August 3, 2015 Share Posted August 3, 2015 Applying P2JS on player and the see-saw won't afffect the mobile perfomance as long as you don't use collision callbacks. You can keep the rest of the world moving using arcade physics. kriket 1 Link to comment Share on other sites More sharing options...
kriket Posted August 3, 2015 Author Share Posted August 3, 2015 Applying P2JS on player and the see-saw won't afffect the mobile perfomance as long as you don't use collision callbacks. You can keep the rest of the world moving using arcade physics.If I enabled P2JS on player, wouldnt that require me to change the rest of the world's (tiled layers) to p2 as well? Else, player wont collide with them. Wrong? For see-saw and player, I wont use callback conditions. Players aim is to just not fall off the see-saws. Thats all Link to comment Share on other sites More sharing options...
icp Posted August 3, 2015 Share Posted August 3, 2015 If I enabled P2JS on player, wouldnt that require me to change the rest of the world's (tiled layers) to p2 as well? Else, player wont collide with them. Wrong? For see-saw and player, I wont use callback conditions. Players aim is to just not fall off the see-saws. Thats allThat's right, but P2JS does not have a big impact on performance and it's the proper way to handle this issue. You should give it a try . kriket 1 Link to comment Share on other sites More sharing options...
kriket Posted August 3, 2015 Author Share Posted August 3, 2015 That's right, but P2JS does not have a big impact on performance and it's the proper way to handle this issue. You should give it a try . Ok, I will try P2JS then and get back with an update later on. thanks again Link to comment Share on other sites More sharing options...
kriket Posted August 4, 2015 Author Share Posted August 4, 2015 So how non-performant is p2 physics on mobile for a tiled platformer game, if you do decide to have callback functions? I need to have them to play my animations in-game when say one character collides/overlaps with another. thanks Link to comment Share on other sites More sharing options...
icp Posted August 4, 2015 Share Posted August 4, 2015 Keep the collision callbacks number at 2-3 per 1000ms and everything should be fine. kriket 1 Link to comment Share on other sites More sharing options...
Recommended Posts