java,android,collision-detection,andengine,game-physics
You should create a new "ContactListener" and bind it to your "PhysicsWorld" By "physicsWorldInstance.setContactListener(...)" and in the ContactListener override "beginContact". for example: public void beginContact(Contact contact) { final Fixture x1 = contact.getFixtureA(); final Fixture x2 = contact.getFixtureB(); if (x2.getBody().getUserData().equals("player")&&x1.getBody().getUserData().equals("monster")) { Log.d("TAG", "Collisoion"); } } ...
animation,sprite-kit,game-physics
The simple solution (provided that this behavior is normal and not caused by, for instance, updating the ball's position manually or via a move action) would be to design the game/physics so speed 1.0 represents the slowest game speed, while at "normal" speed the speed property might be, say, 4.0.
ios,objective-c,sprite-kit,game-physics,skspritenode
Since you are using physics you can use the resting property of SKPhysicsBody. if sprite.physicsBody?.resting == true { println("The sprite is resting") } else { println("The sprite is moving") } Hope this helps....
android,ios,objective-c,sprite-kit,game-physics
Just set the physicsBody property of the SKSpriteNode to nil. If you later need to apply physics again, just assign another physicsBody.
math,vector,box2d,game-physics,trigonometry
First off, you should take the angle of the target relative to the turret, not the other way around. This can be fixed by swapping the position vectors in the subtraction. Second, once you have the target angle, subtracting the turret's current angle will give you the rotation offset you...
If I understand you correctly, you are looking to change the direction, but not the magnitude of your velocity vector. You can get the current magnitude in 3 dimensions using: double magnitude = Math.Sqrt(Math.Pow(x, 2) + Math.Pow(y,2) + Math.Pow(z, 2)); you can then just multiply a unit vector that points...
So following @PaulOgilvie's idea I fixed the problem with the following code: if (BPY >= 160 || BPY <= 0) {//Goal Detection if (BPY >= 160) { playerScore = playerScore + 1; } else { computerScore = computerScore + 1; } DrawCourt(0); EsploraTFT.fillCircle(BPX, BPY, 7, ST7735_BLACK); EsploraTFT.fillRect(computerPaddle, 154, 32, 3,...
This is how you can compute the minimum and maximum (bounding box) of a 3D object. void BBox(GLpoint *p, int n_vert, GLpoint& p_max, GLpoint& p_min) { p_min.x = p[0].x; p_min.y = p[0].y; p_min.z = p[0].z; p_max.x = p[0].x; p_max.y = p[0].y; p_max.z = p[0].z; for (int i=1; i<n_vert; i++) {...
The skew looks like a problem with aspect correction, try, camera = OrthographicCamera(200, 100 * (w / h)); or even, camera = OrthographicCamera(200, 100); To get the end of the box to follow the mouse as in the picture just redefine the box, shape.setAsBox(5, 2, Vector2(offset, 0), 0); ...
game-physics,physics-engine,cannon.js
If you go the sphere/cube path, you get many things "for free" from the physics engine. It includes stable contacts, friction, collision events etc.. If you implement a "force sphere" that applies force in the normal direction on each penetrating vertex, there are a few obvious things that you will...
opengl,graphics,3d,game-physics
Turn the rectangles into triangles. That will make many things more simple since the rectangles in your example probably aren't planar. Select two sides of the triangle and create two vectors which point along those sides (i.e. v1 = p2 - p1 and v2 = p3 - p1). To get...
javascript,for-loop,collision-detection,game-physics
Your conditional should look like: var distanceFromCenters = Math.sqrt(Math.pow(Math.abs(fiender[j].x - kuler[i].x),2) + Math.pow(Math.abs(fiender[j].y - kuler[i].y),2 ); if (distanceFromCenters <= (fiender[j].r + kuler[i].r)) { // you have a collision ...
c++,math,physics,game-physics,orbital-mechanics
You're probably looking for Newton's Law of Universal Gravitation. Gm1m2 / r2 = F Once you find F you can just use it in a standard equation of motion: Fyt2 / 2 + vyt + y0 = y Fxt2 / 2 + vxt + x0 = x ...
java,2d,game-physics,gravity,orbital-mechanics
The following code fixed my issue. I was overcomplicating my math equations as I usually do. Took me three weeks of Googling, asking people with degrees in physics and mathematics, and reading Javadocs before I figured that one out. Turns out how atan2 works is simply different from how I...
Note: I wrote this before looking up the different ForceModes, but all of the advice still stands. Your freeze was because you were asking for too much precision (you're subtracting from velocity by the same amount repeatedly, with no consideration for overstepping (.5 -1 is never 0) or direction (your...
objective-c,random,sprite-kit,game-physics,sprite
Sorry in advance for any english mistakes, as I'm not an native english speaker. From your question I understand that the reason you are keeping a reference to the drop (self.drop) is to check what is its colour when it hits the ground. So you could just delete that, and...
java,android,libgdx,game-physics
you're rotating the group not the actor so try this set the origin of the group to group.setOrigin(group.getWidth()/2, group.getHeight()/2);
You need to put the other iterator inside of the other iterator, try this: Iterator<Rectangle> zombieIter = zombies.iterator(); while(zombieIter.hasNext()) { Rectangle zombie = zombieIter.next(); zombie.x -= 150 * Gdx.graphics.getDeltaTime(); Iterator<Rectangle> blastIter = blasts.iterator(); while(blastIter.hasNext()) { Rectangle blast = blastIter.next(); blast.x += 200 * Gdx.graphics.getDeltaTime(); if(blast.x + 16 > 800) blastIter.remove();...
android,libgdx,game-physics,bounce
Check for the collisions with the walls. I'm assuming you're rendering Bitmaps, so the origin of the square we'll say is the top left corner. In that case: if (x + width >= SCREEN_WIDTH || x <= 0) vx *= -1; if (y + height >= SCREEN_HEIGHT || y <=...
I need an answer so I can format using monospaced. Does the rectangle have an exit that must be met by the ball - so it passes through? -------------- +--+ | | o | | +--+ t0 -------------- +--+ | | o | | +--+ t1 -------------- The ball path...
Add a small delay between render/update cycles to give the cpu time to deal with what you're trying to do, use sometng go like Thread.sleep(40) (25fps)..assuming there's a update loop in there somewhere... Also take a look at BufferStrategy JavaDocs, which has a simple example of how you should use...
You might need to know some physics equation or principle: i.e. 1/2 mv^2 the Kinetic energy of your stone. To make it simple: <Kinetic energy before collision> = <Kinetic energy after collision> + energy accepted by the wall. Hope it would help u....
ios,objective-c,sprite-kit,game-physics,skphysicsbody
The solution was to hold a strong reference to the atlas instead of the textures themselves. This also simplified my code sine I'm already preloading all my atlases with [SKTextureAtlas preloadTextureAtlases:textureAtlases withCompletionHandler:^{ ... }]; at the beginning of my scene. This seems to use the same amount of memory (if...
ios,swift,sprite-kit,game-physics
What I would do in this circumstance is create a SKSpriteNode for the hole, with just a black image as the circle. Then when the two nodes collide, you delete the ball node. I'm assuming you are doing this in your GameScene by the way First, create an enum for...
javascript,game-physics,craftyjs
I've seen something wrong in your code: - on keydown you are calculating and recalculating the Date.now() so just changed this part of the code keyboard[code.keyCode] = true; var then = new Date(); keystart[code.keyCode] = then; with this: var then = new Date(); if(!keyboard[code.keyCode]) { //only if not yet pressed...
c++,game-engine,game-physics,sfml,movement
object.speed = object.speed * TimePerFrame.asSeconds(); This line is reducing the speed every frame until it is 0. You need to scale the movement distance by delta time whenever you move the object. Try this: float distance = speed * TimePerFrame.asSeconds(); sprite.move(cos(sprite.getRotation()*PI / 180) * distance, sin(sprite.getRotation()*PI / 180) * distance);...
ios,swift,sprite-kit,game-physics,skphysicsbody
For Problem 1: your line physics body has a size of 0. You have to create at least a small rectangle which represents the line. Otherwize there is no collision. For Problem 2: func didBeginContact(contact: SKPhysicsContact) { println("contact \(++tempCounter)") println("bitmask1: \(contact.bodyA.categoryBitMask)") println("bitmask2: \(contact.bodyA.categoryBitMask)") } There's a typo. You must use...
unity3d,2d,game-physics,unity3d-2dtools
It is not, however what you can do with rigidbody3d is lock the physics movement and rotation on it. For example, if you only ever wanted it to move along the x and y axis of your game, in the inspector just tick the freeze z movement box for the...
javascript,game-physics,phaser-framework,racing
The reason it stops dead is because you're moving it with velocity, not acceleration - and are setting velocity to zero in your update loop (this effectively says "stop, now!"). Remove those lines and in your call to velocityFromAngle you should feed that into body.acceleration instead of body.velocity. Here is...
I'm not exactly sure what you wan't to achieve... If you wan't to get potential objects at 0.5, 1, 1.5, etc. on lets say the Z Axis you probably would want to do this with raycasting. If you wish to check for any objects returning the direction dependant to the...
math,processing,collision,game-physics
You're initial set up is actually almost perfect. I only changed 2 things in the the third if statement (the if statement which handles the collision with the rectangle). -Added/subtracted the width/height of the dot to the x/y of the dot. Because of this you will not just use the...
Used this in the end .. public void preSolve(Contact contact, Manifold oldManifold) { if (contact.getFixtureA().getBody().getUserData() instanceof Spring){ float impulse = contact.getFixtureB().getBody().getMass() * impulseToApply; contact.getFixtureB().getBody().applyLinearImpulse( new Vec2(0, impulse), contact.getFixtureB().getBody().getWorldCenter() ); }else if (contact.getFixtureB().getBody().getUserData() instanceof Spring){ float impulse = contact.getFixtureA().getBody().getMass() * impulseToApply;...
java,android,box2d,andengine,game-physics
I solved it in my way.. thank you @LearnCocos2D. this.mScene = new Scene(); this.mScene.setBackground(new Background(0, 0, 0)); this.mScene.setOnSceneTouchListener(this); this.mScene.setOnAreaTouchListener(this); this.mPhysicsWorld = new PhysicsWorld(new Vector2(0, 10), false); this.mScene.registerUpdateHandler(this.mPhysicsWorld); final Rectangle ground = new Rectangle(0, CAMERA_HEIGHT - 2, CAMERA_WIDTH, 2, vertexBufferObjectManager); final Rectangle left = new Rectangle(0, 0, 2, CAMERA_HEIGHT, vertexBufferObjectManager); final...
Constant speed can only be achieved in a universe with no other matter. So, you've got to remove friction(no air to bump into), gravity(no other mass pulling on the object to speed it up or slow it down), etc. It'll look very strange if those effects apply to every other...
There is not one with the information you have given. Have you ever collided with a bug while driving? Was there some catastrophe, when it happened? If we are placing value judgements on physical phenomenon, then it would probably be "bad" from the bug's point of view....
box2d,andengine,accelerometer,game-physics
I solved the problem by changing the type of box2d body from dynamic to kinematic, read about body types from here, and found that in my case kinematic body was better as a dynamic body it was getting affected by all the forces in physical world. ballBody = PhysicsFactory.createCircleBody(this.mPhysicsWorld, ball,...
I would probably use something like the following. if(collisionDown == false) { characterYnext = characterY + fall; //Get Next Position if(NextMovementCollides()){ //Basically if next position is too far. characterYnext += difference_between(CharacterY,Ground); //This should move the character to the ground state. fall = 0; //No longer falling so reset the value....
andengine,game-physics,revolute-joints
I think this page has the example code what you need from andengine examples. https://github.com/nicolasgramlich/AndEngineExamples/blob/GLES2/src/org/andengine/examples/PhysicsRevoluteJointExample.java This should help!...
java,swing,animation,graphics,game-physics
Basically, what you are going to want to do is create a new class for Bullet. This class will hold the data values for each individual bullet (x position, y position, x velocity, y velocity). Then, create a list of bullets in your main class. Whenever you want to add...
ios,swift,sprite-kit,game-physics,bitmask
You have to test if the colliding bodies have the correct bitmasks before increasing the score inside didBeginContact. You can use the following code to increase score on collision between paddle and ball. func addScore() { score += 1 scoreLabel.text = "\(score)" } func didBeginContact(contact: SKPhysicsContact) { var body1 :...
There is an easier way. I am assuming that by "right way up" you mean that the feet should always point to the planet. Do the following: Place an additional circular body at the same position as your planet (basically a small circle that is "inside" your planet). That body...
actionscript-3,collision-detection,game-physics,flashdevelop
If you don't want fireboy1 to go past the basePlatform, you should probably do something like: fireboy1.y = basePlatform.y - fireboy1.height Please note that this all depends on both fireboy1 and basePlatform having top-left orientation....
The difference is very simple. The Box2dDebugRenderer is extremely simple to use. It basically requires just a single line of code (the one you already wrote in your question), and it will render simple shapes to visualize your Box2D World. It will render coloured squares, circles, lines and points for...
unity3d,game-physics,unityscript
Attach 2DColliders to both the parent and the child. Attach this same script to both parent and child. function OnCollisionEnter2D(coll: Collision2D) { if(transform.parent == null) Destroy(gameObject); else if(transform.parent != null) print("You win"); } ...
First you have the keyboard event handler in a wrong place. The update method serves only as a callback in update_interval period and you should definitely place it in button_down instance method of Gosu::Window. Second, if you call move method to update game objects positions it is meaningless to do...
c++,timer,implementation,game-physics
One way you can implement a timer in c++ is to use the <ctime> library. A basic idea is to save the starting time and also save the ending time / current time. And then subtracting end - start to see if that has exceeded the max time (time moves...
javascript,three.js,game-physics,physijs
A less computationally intensive way to calculate a vector in the left or right direction is by using the cross-product of of the cameraLookVector and a constant "up" direction. This assumes that the cameraLookVector is never parallel with this "up". In this image, we can choose the b vector as...
You need to use the P2 Physics system that comes with Phaser. Have a look at the Phaser Examples and scroll down to the P2 section specifically. There should be plenty of examples there to get you started, then you can use the API docs to fill in the blanks.
c#,unity3d,game-physics,unityscript
It seems your move function is creating a new velocity vector and overwriting the existing one. Vector2 velocityVector = rigidbody.velocity; velocityVector.x += movement * force; rigidbody.velocity = velocityVector; This will retain the existing velocity, both X and Y, and modify it. You will of course need to add deceleration (usually...
algorithm,game-physics,velocity,frame-rate
Imagining for a moment that your FPS will always be 30, can we express the velocity as a straightforward analytic function of the frame number, rather than as an incremental algorithm? Yes we can, v = 0.98 ^ frame_number. The ^ is exponentiation. Then we can reformulate that as a...
javascript,three.js,collision-detection,game-engine,game-physics
Pretty simple, it's more about geometry and logic than physics... if I understand your simplified world. In the case of boulderdash (or also sokoban), where the movement is tiled-based, when you are about to move the character you first check the adjacent tile, in the direction of the movement. It...
physics,game-physics,unreal-engine4
I think you can just call "Set Target Location and Rotation" on your physics handle.
java,android,touch,andengine,game-physics
Ok so the problem was that in onPopulateScene() i did not put pOnPopulateSceneCallback.onPopulateSceneFinished();. Turns out that even if you define your scene and sprites in onCreateScene() it is still needed t put that in onPopulateScene(). Still I will keep in mind that I should not put 'this' in constructor (even...
cocos2d-x,box2d,collision-detection,game-physics
I got the solution for my question from the below link. http://www.raywenderlich.com/28606/how-to-create-a-breakout-game-with-box2d-and-cocos2d-2-x-tutorial-part-2...
java,swing,collision-detection,collision,game-physics
Real life physics is tricky (gravity, inertia, etc), but to start with, bouncing the balls off of each other: When the two balls hit, there's an angle of collision. Luckily, because they are circles (assuming) you can find the angle of incidence by finding the angle of the line going...
ios,sprite-kit,collision-detection,game-physics
your nodes dont have a physicsbody assigned to them. you're assigning them physicsbody categories, but they have no physicsbody to begin with. It's nil! you need to do yournode.physicsBody = [SKPhysicsBody <some initializer>] ...
unity3d,game-physics,bounce,raycasting,unity3d-2dtools
Your raycast is likely hitting the wrong collider. You start it at transform.position. That is the center point of your ball object. Imagine a ray coming out of a circle's center. What's the first line it hits? It hits the circle itself first. So your Raycast reports the surface normal...
On its iteration y gets lower than the X axis on the first run. Then being zeroed, So max height that you will get in that iteration is lower than original height. The same happens later, Until y will get to 0 without being set to it ( I think...
java,libgdx,textures,game-physics
you try Sprite.rotate(YourRotation); but keep in mind that body.getAngle() returns the rotation that has the body with respect to its initial position, I think you'll have to adjust for use with rotate. for example, take body.getAngle() between frame and frame and the difference the previous frame is that you apply...
opengl,collision-detection,collision,game-physics
When writing collision detection algorithms, it is important to recognize objects are moving at discrete time steps, unlike the real world. In a typical modern game, objects will be moving with a time step of 0.016 seconds per frame (often with smaller fixed or variable time steps). It is possible...
cocoa-touch,sprite-kit,game-physics
The proper way is to center the scene on a node. The best way to learn how to do so is to go ahead and visit the docs here (go to section titled 'Centering Scene on a Node'), but if you encounter any problems with the implementation let us know!...
java,libgdx,physics,game-physics,orthographic
By "experimentally determined," the author just means trying various values until finding something that worked. There's no math or complex magic here. To experiment with it, just change it and run the program again. If you like what you see, use it. If not, adjust it accordingly. The number of...
ios,swift,sprite-kit,game-physics
I have given priority to both functions and the issue seems fixed. let priority = DISPATCH_QUEUE_PRIORITY_DEFAULT dispatch_async(dispatch_get_global_queue(priority, 0)) { // do some task dispatch_async(dispatch_get_main_queue()) { // code with priority } } ...
swift,sprite-kit,game-physics,skphysicsbody
Here's an example of how to move a sprite based on touch. This approach uses the velocity property of the physics body to move the sprite, so it will interact appropriately with other physics bodies in the scene and be affected by damping, friction, etc. First, define the scale and...
matrix,rotation,processing,game-physics,angle
If you want to get an angle between 2 points you can use atan2 the following way: angle = atan2(playerY - bulletY, playerX - bulletX); //This angle is not returned in radians, to convert it simply use the function: angle = degrees(angle); Of course afterwards you have to draw the...
ios,objective-c,cocos2d-iphone,box2d,game-physics
One solution is to run the simulation at a fixed timestep. Let's say you choose 16ms per update. But you still want things to move scaled by actual time elapsed. Now suppose a frame took 20ms. That means you'll do one 16ms update and have 4ms left over for the...
android,box2d,andengine,game-physics,sensor
SOLVED! Ok so the idea to check if our player body left the body of our path is to count borders playerbody passes. So in contactlistener we make beginContact to add one to some int variable (lets say bordersPassed) and endContact subtracts one from it. So when our player is...
javascript,cocos2d-x,game-physics,chipmunk,cocos2d-js
Here you go: //Add the Chipmunk Physics space var space = new cp.Space(); space.gravity = cp.v(0, -10); //Optionally add the debug layer that shows the shapes in the space moving: /*var debugNode = new cc.PhysicsDebugNode(space); debugNode.visible = true; this.addChild(debugNode);*/ //add a floor: var floor = new cp.SegmentShape(this.space.staticBody, cp.v(-1000, 10), cp.v(1000,...
ios,swift,sprite-kit,game-physics
Sounds like a job for a radial gravity SKFieldNode. link
html,css,css-position,game-physics
position:relative means relative to itself not parents/children etc. It seems likely that you want relative on the parent and possibly absolute on the children. Without code, it's hard to help much further Here's a quick demo for you. .container { width: 80%; height: 250px; margin: 0 auto; position: relative; border:...
c#,vector,unity3d,game-physics
Time.deltaTime is the time interval being processed by this Update. At 30fps it is 1/30s assuming no variance in frame rate. For physics you should use FixedUpdate which is always a fixed interval. Time.timeSinceLevel load is at it says, the elapsed game time since loading the level. They are very...
java,android,image,game-physics
I suggest you to write an interface.Lets call it ImageInterface. Now in image interface you can have all basic image related stuff like getWitdh(), getHeight(), getPixelValue(x,y),draw() etc. Use that interface in all of your project. And implement it seperately for cros platforms. You can use BufferedImage for java and Bitmap...
ios,swift,sprite-kit,game-physics,ios-universal-app
There is a SKPhysicsBody class method that could be of help: + bodyWithTexture:size: From the description: Use this method when your sprite has a shape that you want replicated in its physics body. The texture is scaled to the new size and then analyzed. A new physics body is created...
It may be that the opposite KEYDOWN event is being received before the KEYUP. I would guard the KEUP event handling to make sure the opposite KEYDOWN has not occurred. Something like: if event.key == K_RIGHT and active.dirx == 1: active.dirx=0 ... ...
Without really digging into it, my initial impression is that your WheelCollider friction values are probably too low. Increasing the forward friction will probably help with your inconsistent acceleration and the sideways friction will probably address your steering issue.
ios,sprite-kit,physics,game-physics,skphysicsbody
A node does not remove itself from the view once it goes off screen. It's still there but no longer gets rendered. If it has a physics body, physics calculations are still ongoing despite being off screen. The only instance a node gets removed is if you remove it from...
javascript,sprite,game-physics
I think that the create() method only gets called when you create it. This way the if statement only gets called once. You need to check it multiple times (eg each frame). it appears Phase has a class that checks if you're out of bounds. (onOutOfBounds) try: function create() {...
Your for loop is a bit strange here: for(std::list<sf::Sprite>::iterator it = laserList.begin(); it != laserList.end(); laserList;) You'll find that this will form an infinite loop as the value of it never changes. This may be what leads to your crash. To fix it you want to increment the iterator after...
ios,objective-c,sprite-kit,game-physics
In Box2D (the physics engine that SpriteKit uses internally) a single contact can produce multiple invocations of the related callback function. So your score value is being incremented several times because your method didBeginContact is called multiple times for the same contact. You can prevent this behavior in several ways....
arrays,actionscript-3,loops,game-physics
You need something like this: var rocks = new Array(); // Create 10 rocks for ( var i = 0; i < 10; ++i ) { var rock = new Rock(); rock.x = Math.random() * stage.stageWidth; rock.y = 0; rocks.push( rock ); } stage.addEventListener(Event.ENTER_FRAME,stepDown); function stepDown(event:Event) { // step down...
cocos2d-x,collision-detection,game-physics,cocos2d-x-3.0
It seems you are using the cocos2d-x implementation for Physics. So, i have less idea about this. But Generally, this happens when update physics world update rate cycle is low, either by setting or low frame rate. check, UpdateRate of your world. From Doc: /** Set the speed of physics...
algorithm,game-physics,bin-packing
As you only need a heuristic, and not an optimal solution (which nobody can give you ATM, as "distances between items are maximized" is a vague term): Though bin-packing seems to be the "opposite", it can be used. Take a smaller (smallest) box that they fit into, and do the...
python,pygame,sprite,game-physics
To make them spawn in random locations use random.randint(a, b) to assign the start position.
ios,rotation,sprite-kit,game-physics
when you use rotateByAngle it's in radians. theres about ~6 radians in a circle. so you're rotating this sprite many times over. It isn't a 50 degree turn the way you'd expect. You need to be using variations of CGFloat(M_PI). If you want to convert between degrees and radians the...
android,box2d,andengine,game-physics
As @LearnCocos2D stated, I should reset platform body to a legal position while it tries to leave the screen. For this, I should use setTransform method of Body class (as @iforce2d said). For dealing with setTransform, there is two important points. AndEngine uses top-left as anchor of sprites, but Box2d...
If you look at your Update method definition (If you have a regular GameComponent or DrawableGameComponent) , you'll notice you have access to the GameTime: public override void Update(GameTime gameTime). You can use that variable to trigger the collision only after a set amount of time. To do that, surround...
actionscript-3,math,game-physics
Math.atan2(y, x) will convert an x and y value into an angle: var mousePos:Point = localToGlobal(new Point(mouseX,mouseY)); var heroPos:Point = localToGlobal(new Point(Smallclock_hero.x, Smallclock_hero.y)); var dx:Number = mousePos.x - heroPos.x; var dy:Number = mousePos.y - heroPos.y; var radians:Number = Math.atan2(dy, dx); // Convert the radians value to degrees var angleInDegrees:Number =...
java,android,libgdx,game-physics
Try setting the origin of the sprite to center with: setOrigin(sprite.getWidth() /2f, sprite.getHeight() /2f); This will make rotations and scalings use that point instead of default (0, 0)...
c++,opengl,game-physics,physics-engine,bulletphysics
Maybe, not the answer you're looking for, but probably you could use btConvexHullShape, as advised in Bullet documentation? http://bulletphysics.org/Bullet/BulletFull/classbtConvexTriangleMeshShape.html Nevertheless, most users should use the much better performing btConvexHullShape instead. And add vertices one by one using addPoint, which is also mentioned in documentation: http://bulletphysics.org/Bullet/BulletFull/classbtConvexHullShape.html It is easier to not...
objective-c,sprite-kit,game-physics
The answer is simple. Set the SKPhysicsBody's allowsRotation to false. A Boolean value that indicates whether the physics body is affected by angular forces and impulses applied to it. ...
math,graphics,geometry,game-physics,intersection
As @NicoSchertler suggested in a comment, a solution is to take each triangle and clip it on all the planes. If there are no points left (or under 3 points, so it is not a triangle), the triangle intersects the polyhedron. This seems to work well.
So I figured out the answer myself after a few hours of struggle. Simply setting the velocity to zero before the checks worked: EDIT: multiplying it by .89 actually made for much smoother movement. if (kb.IsKeyDown(Keys.W) || kb.IsKeyDown(Keys.A) || kb.IsKeyDown(Keys.S) || kb.IsKeyDown(Keys.D)) { velocity *= .89f if (kb.IsKeyDown(Keys.W)) velocity.Y =...
c#,unity3d,2d,game-physics,collisions
I managed to fix my both problems. To fix problem number 1. I used add force. My new moving forwand and backward looks like this: if (Input.GetKey (MoveForward)) { //transform.Translate (Vector2.right * thrust); OLD !! rb2D.AddForce(transform.right * thrust * Time.deltaTime); } if (Input.GetKey (MoveBackward)) { //transform.Translate (Vector2.right * -thrust); OLD...
java,performance,game-physics,slick2d
Turns out it isn't the graphics drawing routine... it is the dyn4j iteration of the fragments during the World.update() method. Changing the fragment Fixtures to sensors (Fixture.setSensor(true)) so they detect collisions, but don't respond to them, resolves the performance issues and I get about 130FPS if I run the game...
swift,sprite-kit,game-physics,skphysicsbody
You could use init(texture:size:) to create an SKPhysicsBody that matches the texture used by the basket. Here's an example: let basket = SKSpriteNode(imageNamed: "basket") basket.physicsBody = SKPhysicsBody(texture: basket.texture!, size: basket.size) // Do the rest of the setup. In the example above I'm force unwrapping the basket's texture property because I...