mit-scratch : prevent sprite passing a certain boundary - mit-scratch

I'm making a beat-em-up game. Noting the image that you see, I want to prevent my sprite character from passing the fence in the backdrop or where it divides the the floor from the net ball stand. What blocks would I require to create a sort of barrier that stops my character passing that fence?

You can decrease the Y until the sprite is visually not passing the boundary

Related

How to create movement speed limits when a character overlaps the surface of the water

How to adjust the speed of the character when crossing a cube with water?
And how to make it move more slowly on the surface of the water, while leaving the ability to move with Shift?
Speed up movement when pressing Shift
Water surface blueprint
Water surface blueprint components
Put an OnComponentBeginOverlap event on 'BP_WaterRegion' that checks what kind of actor it's just overlapped with. If it's the player character then you can set the MaxWalkSpeed variable on the character from there. The OnComponentEndOverlap event should be self-explanatory now.
If you select 'WaterMesh' you should find these events at the bottom of the Details panel.
(It's a while since I've worked in UE - you might need to connect the output from the cast node to the == node instead.)

Active ragdoll character stands still on the ground

I have a character which is controlled with physics stuff like Spring Joint and Constant Force (The character is active ragdoll).
I want to stick the character's legs to the ground and when it is bent left and right, the entire character doesn't move on the ground.
What is the way to achieve it ?
Currently I use Fixed Joint on both legs with Constant Force but still the character moves around when there is sudden force on upperbody.
As you can see in the gif.

Unreal Engine 4 - Collider component sweep issue

I have a 2D environment where an object falls (a trap) and a box collider component is moved with a timeline to follow the movement with SetRelativeLocation.
Since the trap is near a wall if I leave the Sweep option unchecked in some cases the character will stuck mid air between the trap and the wall.
Sweep off
If I turn on Sweep this will not happen and the character is pushed to ground correctly but since the collider "slows down" for some frames it seems to be in the middle of the sprite.
Sweep on
Teleport option seems to have no effect on this behaviour.
Is there any way to have the sweep effect with the collider keeping his velocity and keeping the structure as it is with the collider moved by a timeline?
I feel like I'm missing something really simple but I'm losing my head on this.
Thanks!
Since it's 2D, have you tried blocking the input when your character collides? I would add a simple collider in front of your character and when it is overlapped, I'd limit the input in the direction your character goes, ie.:
Character collides right
MoveRight(float Scale): Clamp Scale to (-1.f, 0.f); AddMovementInput(...
Hope it helps!

Sprite Kit Physics Body Complex Shape - Spritekit

I have this situation: http://mokainteractive.com/example.png
I'd like to move the white ball inside the red track and detect wherever the balls touch the limit of the red track.
Which is the best solution? I have to create multiple transparent shape along the borders? Do you have other ideas?
thanks so much
In iOS8 you can create a single physics body for that kind of shape.
Make a texture of your shape with p.e. Adobe Illustrator and use this method:
init(texture texture: SKTexture!,alphaThreshold alphaThreshold: CFloat,size size: CGSize) -> SKPhysicsBody
The SKTexture is your shaped image. The body is defined by the colored pixels.
The alphaThresHold: The minimum alpha value for texels that should be part of the new physics body.
The Size is clear I think.
The texture is analyzed and all invisible pixels around the egg are ignored and only the color pixels are interpreted as the body of the SKPhysicsNode. You should use too many of these because they are very expensive to calculate for the Physics Engine.
Variations of this method are found in the SpriteKit Class Reference.
To your problem. Make an inverse texture of your area which should be transparent and pass it as texture to the physics body. It will be analyzed and a body around the free zone is created.
You cannot create a single physics body for that kind of shape.
Using bodyWithPolygonFromPath: will only allow you to create a convex polygonal path which obviously does not work for your shape.
I think you have 3 options here:
Use a number of bodyWithPolygonFromPath: bodies (probably the hardest to do and time consuming).
Use a number of various size bodyWithRectangleOfSize: bodies (not so hard but time consuming).
Use only straight lines in your image and use bodyWithRectangleOfSize: (the easiest and fastest). If you choose this option remember you are still free to rotate your straight lines to various angles.

animating object along a path in unity 3d

I need to animate an object along a path. I am doing so by creating an animation like:.
This works great but since my terrain is not flat it will be nice if I don't have to deal with the y component. In other words I want to move an object along the x-axis and z-axis and if there is a small slope increase then increase the object y position. same thing if there is a downward slope. Or maybe I have to create a script where it checks to see if the object is colliding with the terrain. if not then decrease its y position. I don't know if this will work meanwhile animating an object though.
I think the easiest way I can think of to solve this is for you to make the object a rigid body and use collision (probably a mesh or capsule collider if its a player character) to get it to sit on the floor.