Tag Info

New answers tagged

0

You could remedy to this by adding another bool canJump : public void Jump () { if(canJump) { if (grounded) rigidbody2D.velocity = jumpVelocity * Vector2.up; canJump = false; } } So when you are clicking, the Jump() method will run the jumping loop one time.After this code, you will need to set the canJump ...


0

In your scene controller, you should do this inside -(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event: UITouch *touch = [touches anyObject]; CGPoint touchPos = [touch locationInNode:self]; touchPos will have the position inside your scene, and you can do: if ([self.cardOne containsPoint:touchPos]){ //Do something CGPoint ...


1

So the short answer to my own question is, "Yes." The long answer is... Using Metal—and, I assume, OpenGL ES—you can create no-copy data buffers from memory-mapped files on disk. From there, you can create textures from those buffers. There are constraints, however, in that the texture data must be an uncompressed pixel format, can only have one mipmap ...


0

I found that it is because I was using a dynamic body rather than a kinematic body. I still have a bit of learning in regards to how physics works with scene kit.


0

If you're working to build a 3D viewport you probably want a projection matrix. Which means in addition to your normal n you also need to define an "up" vector in the plane. That is, if the plane represents the screen of the iPhone, you need a vector that shows which direction the top of the iPhone is. Then, your n vector crossesd with your up vector will ...


0

To keep a character level with a moving "ground" without its x position being affected by the physics engine, it would seem the best solution might be to place an SKConstraint on the character. Specifically: character.constraints = [SKConstraint.positionX(SKRange(constantValue: 0.0))] If you have any weird bugs from SpriteKit's physics engine, you might ...


2

You're only getting angles in the top-right quadrant because you're taking the absolute value of dy & dx. The sign information is important for determining what quadrant atan2 should return. What I'd recommend instead is using vector normalization, rather than trigonometry. dx = touch.x - startPosFrontJoystick.x; dy = invY - startPosFrontJoystick.y; ...


0

This is not possible. Apparently, only a dynamic volume physics body can make contact with an edge body. I do not like this about Sprite Kit.



Top 50 recent answers are included