physics

Optional unwrapping SKPhysics error

让人想犯罪 __ 提交于 2019-12-11 09:49:54
问题 Before I'm crucified with downvotes let me say I have done research into this and I still cannot understand why I am getting this error. I have a core that the player is trying to defend and you can shoot little lasers out from it to defend against incoming meteors. Well, I have everything set up and working (most of the time anyways), but every once and while when a laser hits a meteor and my collision handling function tries to remove the shot node and meteor node, it throws this error:

PTM_RATIO in retina display using Box2D, cocos2d and Physics Editor

♀尐吖头ヾ 提交于 2019-12-11 09:45:06
问题 I’m having a lot of problems trying to draw body shapes on my sprites. I tried a lot of combinations but I’m not able to make it work on retina display. I’m supporting iPhone retina only and both iPad (retina and not retina). A. PTM_RATIO The first question is which PTM_RATIO use for each device if I want the same physics in all devices. I read several posts and I don’t know if PTM stands for “ Point To Meter ” or “ Pixel To Meter ”. ¿Which column is the right one? B. Physics I want do draw a

Why is collision response allowing bouncing sphere to eventually pass through Plane?

倾然丶 夕夏残阳落幕 提交于 2019-12-11 09:44:30
问题 I'm currently replicating a particle system in Unity (C#). I am adding physics to each particle (represented by a sphere) to allow it to bounce off a plane located at the origin. The particle bounces a number of times, being affected by gravity. As the bounces become smaller the sphere starts passing through the plane until finally falling through. The force of gravity will be continuously acting on the particle. What is the proper way to stop the sphere on top of the plane? I have included

Hinge Joint making rope

試著忘記壹切 提交于 2019-12-11 09:13:40
问题 I've entered unity3d programming a few months ago. I've been clear some project with unity3d easily. In recent my project I have to make a rope like chain. I read some articles and make it with Hinge Joint. Problem: Smaller count of joints it works well. But if it over one hundreds of joint, it loses it's safety. Progress: So I have been looking for solve this problem, but I can't find its perfect solution. How can do this? How can I solve this problem. thank you for read my article. 来源:

How do I keep the angle of a body in pybox2d between -pi and pi?

限于喜欢 提交于 2019-12-11 07:34:49
问题 In the pybox2d manual it states the following: pybox2d uses radians for angles. The body rotation is stored in radians and may grow unbounded. Consider normalizing the angle of your bodies if the magnitude of the angle becomes too large (use b2Body.SetAngle). However, when I try to implement something to 'normalize' the angle I get the following error: AttributeError: 'b2Body' object has no attribute 'SetAngle' Code snippet: def update_outputs(self): # This is necessary to prevent the angle #

Realistic simulation of sphere rotation on a floor

£可爱£侵袭症+ 提交于 2019-12-11 07:23:30
问题 I'm trying to simulate a sphere rolling on a floor. For the simulation I'm using the good-old Papervision3D library of Flash AS3, but it actually doesn't matter, this is a pure geometry question. Assuming that I have a Sphere3D object to which I can set the rotationX, rotationY and rotationZ properties, How can I calculate the rotation in every axis where this sphere is rolling on the floor? For instance, Let's assume the sphere is in rest. Now it rolls 1 meter to the right. If I'm looking at

How to get smoother 2d projectile physics

最后都变了- 提交于 2019-12-11 07:14:10
问题 So I want to start working on a 2D platforming game, and I won't be in physics till next year, so I found the equations in an old physics book I had to help be find the x and y positions along with their velocities. The problem is, they seem to accelerate too fast in that the rendering is too slow. It's not the programs fault, its my fault in that I don't know how to slow down the acceleration so that it looks smoother. Here is the code for the ball class that i'm using (i know the code is an

jumping code in javascript

女生的网名这么多〃 提交于 2019-12-11 04:43:25
问题 I'm eleven and new to programming, and I'm making a simple platformer for a game comp at my school using javascript. Right now I'm working on the code that makes the character jump. It's more complex than the character just going up and then down, because I want the movements to be fluent and look realistic. When the character jumps, it leaves the ground fast, then slows down as it goes higher, and when it reaches a certain point, it will start to fall slowly. It will speed up as it falls

Verlet algorithm implementation in Python

本秂侑毒 提交于 2019-12-11 04:35:16
问题 I have problem with implementation of verlet algorithm in Python. I tried this code: x[0] = 1 v[0] = 0 t[0] = 0 a[0] = 1 for i in range (0, 1000): x[i+1] = x[i] - v[i] * dt + (a[i] * (dt**2) * 0.5) v[i] = (x[i+1] - x[i-1]) * 0.5 * dt t[i+1] = t[i] + dt But it is not working properly. What is wrong? I am looking for general code for Verlet algorithm. 回答1: Your question isn't very clear, but there are a few sources of error in your code. Eg, for i > 0 x[i+1] = x[i]-v[i]*dt+(a[i]*(dt**2)*0.5)

“pushes” matching UIInterpolatingMotionEffect? (i.e. access “physics” on UIInterpolatingMotionEffect)

≡放荡痞女 提交于 2019-12-11 03:24:19
问题 With UIInterpolatingMotionEffect, twist the iPhone, and you can have an image move. Now: imagine a red block you will "bounce around" on screen, using UICollisionBehavior and UIDynamicItemBehavior. When the user twists the iPhone: I want the boxes to "start moving" WITH SIMILAR PHYSICS FEEL to using UIInterpolatingMotionEffect. http://tinypic.com/player.php?v=b67mlc%3E&s=8#.VBVEq0uZNFx Aside:UX explanation: the bouncy effect (example: SMS on iPhone) has the same "feel" as the parallax image