Revisit 8 - Argh

Web log of development issues.

Revisit 8 - Argh

Postby adamsderk » Wed Jul 01, 2009 5:13 pm

Greetings,

As I've been working on the buildings object, I found a "problem." The building is a trigger object that identifies when a player enters and exits a building. Inside the trigger object is an identical sized physical zone object which reduces the speed of the player by half. The top of the trigger is solid when the player is above the trigger, so it can be stood on. But one of my tests was to jump into the building such that half of the body was above the roof and half below as it entered along the side. And what happened? The player slid through the building without falling and popped out the other side. Argh.

So I started going through the collision code (which I was modding to make the trigger object solid) and removing objects and it didn't make any difference. I did find out though that it had to do with the physical zone object. So I look at the code for that and happen to notice the default values...

Ok, the physical zone can do up to three things, 1. change the velocity (which I am using), 2. change the gravity (so you can pop up of fall fast), and/or 3. apply force (push the player in a specified direction and speed). So in my test object I set velocity to 0.5, gravity to 0, and force to "0 0 0." Did you see it?

Yea, gravity should be 1, which is the default. So when I entered the building, I couldn't fall and just sailed through to the other side. Doh. Amazing, setting it to 1 makes it work just like I wanted it to. :)

However, I'm still left with my jittering problem of the trigger not being ghosted to the client, so I decided to make a new object; the BuildingObject (real original). It will combine the StaticShapeObject, the TriggerObject, and the PhysicalZoneObject into a single object. This also allows me to put the code that turns model pieces on and off into this object instead of adding it to all objects.

Thanks.
Image
adamsderk
Site Admin
 
Posts: 1404
Joined: Tue Apr 19, 2005 11:52 pm
Location: Western Washington

Return to Development Blog

Who is online

Users browsing this forum: No registered users and 2 guests

cron