Tag Info

New answers tagged

1

I believe the problem is that you're assuming that the ball is at a constant speed throughout the time step. The relevent parts of your code are: ball.y += ball.y_speed * deltaTime / 1000; ball.y_speed += 1.5 * deltaTime; Unfortunately, this method only gives an approximation of the position, and this is why you are seeing errors. You are not taking into ...


0

Try basing your calculations on system time if you want it to be non frame-rate dependent. The only thing I can say is that basing the movement calculations on frame-rate should mean that if the frame rate drops then then the ball should slow down with the frames. I have done something similar to this before and what I did is each gamestep or MainUpdate ...


0

There are a number of techniques used to solve this problem. Generally speaking the technique is called Inverse Kinematics, whereby after the pose is complete, the pose is modified to fit to a specific point - hence being Inverse Kinematics - http://en.wikipedia.org/wiki/Inverse_kinematics This can be solved through various means - animation or algorithm. ...


0

I could pass the character controller the array of points representing the island that it is currently colliding with, but then iterating through all of the points and finding the points closest to the character seems like a lot of work to do on each frame When the collision first occurs you could save the id/index of the point in the array that is ...


0

The bounding box automatically move with the sprite. If you don't believe it, use the ShapeRenderer to draw your sprite's bounding box each frame and check if it actually follow it or not.


1

I wonder if chopmunk allows the object to be made static inside a callback issued from the guts of the physics engine. What if you set a flag on the object and after updating physics you set things static? It would be worth checking the documentation on cpSpaceRemoveBody. I looked into the source code for chipmunk, and here's the relevant function: void ...


1

Movement should never be dependent on framerate. Bob Nystrom wrote an excellent summary of how to write a game loop that is independent of framerate. Check it out here. He starts with the most basic game loop then makes incremental improvements, discussing the motivation behind each iteration. I've added his code here but you should really check the article ...


1

You need to separate your games logic from display logic. Game logic should run at some fixed rate (e.g. 100 ms). Display should query the state of the game and display it at unconnected rate (e.g. 10-20 ms). That way your display performance never affects the game.


0

It depends on what type of collisions you want to resolve and who controls the wolf. Wolf is NPC If you want to resolve collisions with static environment you should think about using NavMeshAgent and bake static geometry to navigation mesh (so, that kind of collisions will never happened). If you want to collide wolf with other units with simple colliders ...


1

This picture exemplifies it well. In the given example the rope pulls the robot with the blue vector (a force in the direction of the rope). Once you let go of the rope, of there wass no gravity the robot would move with equal speed in a straight line tangential to the point he stopped the circular motion. If there's gravity, the only acceleration on the ...


4

Circular motion already has velocity; what makes it circular is the continued application of a rotating acceleration of constant magnitude. So to let the object leave the circle at the proper velocity, just stop applying the acceleration.


1

From my personal experience, some basic physics knowledge can help a lot to tune your game. Lets say that you want to create certain physical effect in your game e.g. players can push boxes. Of course, you need to tune certain parameters to make this effect behave as you want, so that the boxes neither violently fly in every direction neither are almost ...


3

Bare minimum you need to know how the physics SYSTEM works within the engine. Most of these may sound daunting but it's really not that difficult and you CAN simply stumble through things but it will make it significantly easier if you understand these going in. What is a RigidBody? What is a Collider? What is the relationship between the two? How is it ...


0

I think it's enough for you to know how gravity and forces work, although you actualy don't have to know these, because physics engine does everything for you(ESPECIALY UNITY). Like the first komment says, just play around and learn how to use the engine.


2

While the character is running, mark the surface that he's running on as the active running surface. As long as the speed does not reduce to 0 (or reduced, depending on your mechanics), you're on the same surface, no matter if the head touches another surface. To detect where you go next, if your surface is stored as a grid, store last grid cell that you ...


0

You can use the dot product of a world up vector with an up vector relative to the player. If both of these vectors are normalized, you're results will be between 1 and -1. With 2d vectors the dot product is calculated by taking the product of the x components and adding them to the product of the y components. Given the vectors A = (x,y) and B = (X,Y). ...


0

You could have two collision sensors: one just under the character's feet and one just over it's head. Then it would be a matter of checking the positions of both sensors when they are both triggered and if the foot sensor is higher than the head sensor then you know that the body is upside down.


0

tl;dr code example with md5 (you can run it here): function getHashTail($pair) { $res = hexdec(substr(md5($pair), -4)) % 1024; return $res < 100? dechex($res % 16) : ' '; } Usage example: <html> <head> <title>Hash space</title> <style> div { text-align:center; vertical-align:top; ...


0

What you're describing is procedural generation (of some kind of universe in this example). This is actually rather trivial to do. Basically you'll just have to calculate everything on basis of your coordinates. This can either be done by simple math or by using the coordinates as the seed for your random number generator. In your example, you want 20 % of ...


1

First of all, if you want to avoid aliasing problems, you need to respect the Shannon rule. So you need to take 120FPS or more. Secondly, you don't really need to care, you can simulate at 40 if you want, just be sure to linearly interpolate all of your matrices, the frame presentation time is the t, and your physics simulation always have to run some ...



Top 50 recent answers are included