Collision using a region instead of character

Non-platform specific questions.

Collision using a region instead of character

Postby arcreamer » Sat Dec 28, 2013 11:31 pm

Hey guys, so Im working on a collision with my actor so I can create gravity so what I have done was created a filled region for the ground collider, and another filled region for my player collider. Im not very experienced at all with programming, so I probably went about this all wrong, but then I parented my player to the player collider, and in the collider I put if in the Draw Actor:

Code: Select all
if (yvelocity<4)
{
    yvelocity+=.08;
}


when I played the game, it did what I wanted to do at first which was have the player collide against the ground and the reason I knew he collided was because I placed him a few feet off the ground before playing. But once I started walking, I was able to walk right off of the edge of the ground and wasnt falling. its as if the collider just stopped working or something.. not sure. Ive been looking for some good collision tutorials but none with using a region as a collider instead of the actual player. any help would be great
arcreamer
 
Posts: 398
Joined: Tue Jul 03, 2007 4:08 pm
Score: 9 Give a positive score

Re: Collision using a region instead of character

Postby skydereign » Sun Dec 29, 2013 7:07 am

It sounds like you aren't moving the collider region left and right. Since your player is parented to your collision actor you need every form of movement to use the parent actor.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Collision using a region instead of character

Postby arcreamer » Sun Dec 29, 2013 11:49 pm

is that even a smart way to do this? because Im using Hblade's anti-moonwalk in my draw actor of my character
arcreamer
 
Posts: 398
Joined: Tue Jul 03, 2007 4:08 pm
Score: 9 Give a positive score

Re: Collision using a region instead of character

Postby skydereign » Tue Dec 31, 2013 7:40 am

There is a pretty smart way to do it. Because the player is parented to the filled region you can change lines of code that use xvelocity or any other movement code to parent.xvelocity. This way it works exactly the same way, it will just use the parent's x/y/xvelocity/yvelocity and so on.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest