New answers tagged

1

The server receives the connect event when the client connects to the socket.io server. At this point, you can implement a simple verification to make sure that the person connected is supposed to be using your application. To do so, the next event the client must send is a sign in event with some credentials (a token, for example). You can then validate ...


0

After a bit of a research regarding Socket.io I realised you can control the origin that is connecting to your game (The Client) using the origin option, you can read about it over here - Socket.IO server API. if I understood you correctly you wish to control the connections and you want to accept connections only from a specific uri (correct me if i'm ...


1

If you have access to the box you're connecting to, couldn't you add a firewall policy to only allow a specific domain? If you don't have access to the box directly, perhaps whatever hosting service you're using allows some form of firewall control for access to your endpoint? As far as I know, that's the only way to truly prevent connections. There are ...


0

I was actually able to accomplish this by doing the following (there might be a better way than this, but it worked). This answer below is a bit specific to Box2D, as this was the original question's context. Here are the requirements we want When we make contact with the top of a platform, we want to enable the collision and stop the player If the player ...


2

I'm pretty sure you can deal with this by ignoring the collision if the y-component of the velocity is positive (the player is moving upward). Alternately you might be able to use the collision filtering flags. One-way floors are given their own contact group, and the player object can set/unset whether or not they collide with this group based on their ...


1

As you probably already know based on how you formulate your question, the physics engine only registers collisions whn at least one of the colliders have a rigidbody attached. In many cases you can just add a kinematic rigidbody that is not affected by gravity to get a collision detection going. Unfortunately the Collision2D.ContactPoints, which is of type ...


1

Your primary question is: So how do I implement the force? Considering that your body is always underwater, there's an easy way out of this one: just use gravity :) As iforce2d points out in his tutorial on custom gravity, you can set the gravity scale of any object: //Box2D v2.2.1 onwards body->SetGravityScale(0);//cancel gravity (use -1 to ...


1

If you apply too much force to a plank, then the connecting joint is going to break. So that should be your indicator that the plank needs to be destroyed. At first, I'd just destroy the plank when the joint of the plank breaks. I think that's pretty much what's happening in the video you linked to. You could further refine the process by doing something ...


0

I think that the most simple way of getting around your problem is as follows. I assume that your player entity helps you keep track of his state. Maybe it's running, or climbing or whatever you might have used. If you add to make sure that the only time you will ever check if the player sprite is on top of an enemy is when the player's state is falling, ...


1

Brief: The solution is not in collision listeners, but in collision filters. Collision filters have a shouldCollide method that you can implement to return false if you want to disable collision or true to allow it. Collision filters are executed before collision listeners. You can use, for example the linear velocity of the player sprite to decide if you ...


0

The fixture position in box2d is in relation to the body position. So if you set your fixture to be at (5, 5) the body is still at (0, 0) and if you then move the body to (1, 0), the fixture will then draw at (6, 5). It looks like you are getting your sprite position from the Body position, not the fixture position in the original method. In the second one,...



Top 50 recent answers are included