Tag Info

New answers tagged

0

Try creating a physics material and adding it to your object and then in your code write the code below whenever you want to change the friction: collider2D.material.dynamicFriction = YOUR VALUE HERE; collider2D.material.staticFriction = YOUR VALUE HERE; (Dynamic friction is the friction while object moves and static is hen it isn't moving) Make sure you ...


0

Spatial partitioning is most definitely the way to go. The book 'Game Programming Patterns' has a very accessible chapter on the subject (http://gameprogrammingpatterns.com/spatial-partition.html) so I'd highly suggest reading that, as well his chapters on the game loop and update method. Also, if I understand your comment correctly, each different type of ...


0

What you're looking for is "spatial partitioning". You want to break up your world space into smaller chunks to cut down on how many objects you detect collision against. Since you're just doing 2D you'll probably want to use a "quad tree". There are other options including BSP trees but in my experiences quad trees are the best all around solution. As for ...


0

If I understand your intention correctly, you are trying to figure out how to reduce the number of collisions to check for, which is basically in the realm of 'potentially collidable set reduction'. If so, you'd do well to research spatial subdivision and/or nearest-neighbour search algorithms (such as octrees, KD trees, BSP and the like). One (or more in ...


0

You don't want to use setLinearVelocity for horizontal movement as that set's the velocity to a value it will cancel out any force applied because of a jump. For moving left and right you want to use either applyForceToCenter (like what you do for your jump), or applyLinearImpulse. You might want your code to do something like this to limit the ever ...



Top 50 recent answers are included