PhysicsJS: Body is clinging to the corner of another body while sliding down - physicsjs

So, I'm making a small 2D platformer. I have a flat "tower" of several static blocks standing on each other and one another dynamic body (the player) which jumps to the top of the tower and sliding down, colliding with it. But sliding is very rough, because player is clinging to the top corner of any block in the tower all the time.
Working example: http://rogovoy.me:3001. Just try to jump on the right wall and keep pressing the "move right button". Controls: W,A,D or by arrows.
restitution and cof are 0.
I know the reason why it happens, but I have no idea how to solve it.
Sources: https://github.com/flashhhh/gippo-jump-game

Related

Trying to have no boundaries in my runner game

Still new to Unity. I am trying to make a 3D runner game. So I have a ground that is spawning as my player moves up the map. It spawns forward. However, I would like to make my ground spawn to the right and left side of my character so that my character never falls off the map. Just an endless ground spawn. How do I go about this?
I tried doing transform but the ground would spawn in a y axis instead of building along with the original gound.
Judging from what you wrote, it seems that you are holding the wrong axis when grabbing the currently created position.
I don't know what type of runner game it is.
There is a difference in the methods you can try when the character is fixed in place and when it is freely moving on the screen.
Fixed
The character only jumps in place, and the map is continuously created left and right, and you can make it by thinking that the map moves.
If the character passes through a specific point (eg the center of the map), you can create a map in the direction it crossed.
Moving
The second method suggested when it is fixed is a general example. If you want to design a map that can move up, down, left, and right, you need to think a little more. If you create a map on the top, bottom, left, and right in a repeating form, you can try a method similar to that created on the left and right.
You can find many examples by searching for keywords such as Endless Runner on YouTube or Google.

Move player in all directions with touch?, Unity

I was creating a basic scenario in Unity. Thi scene have 1 cube in the center of the room, and 1 camera(player).
I need to move the player around the cube like if was flying ( with movements at the top, bottom, left, right, inside and outside), very similar to when we move freely with the mouse on the development screen.
I need make this movement with the touch.
How can i to do?
Thanks!!
You can achieve almost all movements you want using a standard fps mobile controller: 1 joystick and a slide area for rotation. Your forward movement will be your player's forward direction(with W in unity you move always forward) and of course transform's left/right for strafe.
The tricky part is move up/down part(even in Unity editor you have to use 2 extra keys, Q&E) but you can always move up/down just looking in that direction.
if u use the unity standard asset 'cross platform input' (which is available in the standard asset pack for free,) then anything you program with a mouse event or click, will automatically call the corresponding touch event if use on a phone.

How do you wrap a level around based on the players position

I want to create a circular room in a 2D level. How can I handle this problem?
My thought process was to break the level into chunks and move their position depending on where the player currently is. This would allow the level to wrap around depending on where the player travels. I can do this manually with each part but i'm looking for a better solution that can handle this programatically. I'm open to better ways to solve this problem as well.
Is the space 2D? if so, you could place two invisible colliders at the extremities of the room (one at the beginning and one at the end), and change the player's position when he collides with them. To ensure that the transition is smooth, place them a little outside of the camera space: the player won't be rendered during transition, and you would obtain a teleport effect from side to side.
As another suggestion, you can lock the player to being in the center chunk with a camera just showing that chunk. Everytime he gets through a collider on the end or the start of the middle platform you delete the opposite side platform and place it in the far end of the platform the player is now seeing, effectively making the new platform as the middle one.

Make an object rotate according to mouse movement. [UNITY C#]

I’m starting a learning project. The idea is that you have an archer character that is static, that has a bow attached to it that shoots arrows to targets of varying difficulty.
Turns out that right at the start I’m stuck. How do I make it so that the bow rotates when the player clicks and holds the mouse anywhere on the screen? So I click+hold and move left/right and the bow rotates left/right to aim the shot. I’d like to also eventually make it portable to phones (so you’d tap+hold etc).
Stack Overflow isnt a code writing service but i will explain what you must do:
Method 1 (Exact Aiming):
For every frame the mouse is down:
Make a Ray from a screen point... hint (use
camera.ScreenPointToRay).
Get a far point along the Ray using ray.GetPoint(distance);.
Bow.Transform.LookAt(newPoint, Vector3.Up);.
Method 2 (Continuous Movement):
Make a variable oldMousePos to store a Vector2 location.
Record your initial screen click position into that variable on a
mouse down event.
Have a function that runs once every frame the mouse stays down.
For the direction of the rotation of the bow, you can use
(newMousePos - oldMousePos).normalized;.
For the speed of rotation for your bow, you can use (newMousePos -
oldMousePos).sqrMagnitude;.

How to stop the forces acting on a body in box2d

I am using box2d on the iphone to create a game. I have a body that is effected by gravity to move down and not right or left. It will get hit by another body and will then be moving right or left. I then have a reset button which moves the body back to its starting point. The only problem is that it is still moving right or left. How can I counteract the forces that a ball is already traveling? How can I get rid of this right and left movement when I reset my game?
Box2d automatically clears the forces each simulation step. I think you are just changing your body's position when resetting, but not its velocity. Add this code to your reset method:
body->SetLinearVelocity(b2Vec2(0,0));
body->SetAngularVelocity(0);