Tag Info

New answers tagged

0

This article: http://www.ai-blog.net/archives/000152.html gives a good overview of Navigation meshes and discusses dealing with realtime modification of the mesh due to environmental changes at least a little bit... The basic idea is that you mesh out all the potentially walkable spaces by default, then either mod a section of the mesh, or deal with moving ...


0

What you're really looking for are navigation meshes: These meshes will conform to the walkable areas in your game. You can make the nodes as small as you like. In this way, you can have far fewer nodes for your A* algorithm to work on. You can still have smaller nodes if you like for fine detail pathing, or you can use something like steering to get ...


0

You were mistaken about how to separate the forces. The torque applied is the cross product between a_t and r where r is the vector from center of mass to the point the force is applied to. (or length(a_t)*length(r)* sin(theta) with theta the angle between the two) The translation force is just a_t. These results can be manipulate independently which ...


0

You are doing most of it already. When you wrap the car around the screen, you are incrementing carspeed. But you never use the carspeed variable. You are using the velocity vector to control the speed of the car. You could, for instance, increase the velocity instead of carspeed.


0

This looks like XNA/Monogame. If you really wanted to base it on the draw rate, change the code in the Draw() method to toggle a bool and increase the Car object position property whenever the bool toggles true. Ideally you really don't want to do this on a draw - the car's position should be handled by update as everyone gets different refresh rates and ...


4

Magnets are kinda hard to simulate, but if you are looking solely for the effect of pulling and pushing objects you can use coulomb's law and simulate an electric field. Basically there are some points in the plane with an electric charge, which is either positive or negative. Since you are not aiming to do a physics simulation and for a game you are only ...


2

You have to attach the wheeljoint2d to another sprite wich with a rigidbody2d for it to work. So yes, you should attach it to another rigidbody2d.


1

//temp helper variable var moveAmount = Point.Zero; if (InputHandler.KeyPressed(Keys.A) || InputHandler.KeyPressed(Keys.Left)) moveAmount.X -= 1; if (InputHandler.KeyPressed(Keys.D) || InputHandler.KeyPressed(Keys.Right)) moveAmount.X += 1; if (InputHandler.KeyPressed(Keys.W) || ...


1

It's because of the variable IsOnGround and duration of jump key. Imagine this, no matter how fast you are. Update will be called 60times a second. That makes jump key true for more than a instance. Also it takes player time to achieve lift off making isOnGround true for more than one instance . Hence the inconsistent jump, try switching isOnGround to off ...


0

You might be using a net-like structure, where each gear knows about all gears it is in contact with. When you need to apply a rotation, you pick a master gear that you start with and recursively rotate all its neighbors. If you want an algorithm to find a master gear - there's really none. You just pick gears that has only one neighbor and choose one of ...



Top 50 recent answers are included