| We hope you enjoy your visit. You're currently viewing the Ultimate 3D Community as a guest. This means that you can only read posts, but can not create posts or topics by yourself. To be able to post you need to register. Then you can participate in the community active and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free. Join our community! If you are already a member please log in to your account to access all of our features: |
- Pages:
- 1
- 2
| Most Efficient Way to Check and Apply Z Gravity?; MAJOR slowdown using AttemptToMove | |
|---|---|
| Tweet Topic Started: Dec 1 2008, 12:27 AM (904 Views) | |
| Jerreldulay | Dec 1 2008, 12:27 AM Post #1 |
|
Advanced Member
![]() ![]() ![]() ![]() ![]()
|
Hi guys. The problem I'm having is that whenever my characters in the game end up walking on terrain or going on stairs (cases when their Z values are checked and changed), I lose an unbelievable amount of FPS. All the characters have their own models, and all those objects currently run the script copied from the SDK example: //apply gravity zprevious2=z; falling_speed... etc. etc. //Do the collision detection and response free_position=AttemptMoveToPosition(etc. etc. etc.) What this code should do is allow characters to walk on terrain and stairs while adhere to the solid objects. This is fine and dandy, and works, except for when I have more than one character running this code, the game lags terribly. (The difference between letting AttemptMoveToPosition check for changes in gravity and Z downward movement is around 25 FPS when there are 4 models on screen) If I disable this code's ability to use gravity, therefore changing the position which AttemptMoveToPosition checks, the game runs at normal speed. The characters will walk UP ramps and terrain, but, of course, will not walk back down the terrain. I have tried using CheckSweptEllipsoid etc. etc. so that the gravity will only be active when there is nothing below that character, but it didn not seem to work for me. My question is: is there a faster method to obtain the effect of walking on solid objects and terrains, and if not, how can I use CheckSweptEllipsoid to toggle gravity on and off for a model. I really only want to check the value of one spot at the feet of the character, for gravity purposes. Thanks tons for time and assistance. I really appreciate it. Edited by Jerreldulay, Dec 1 2008, 12:29 AM.
|
![]() |
|
| skarik | Dec 1 2008, 02:05 AM Post #2 |
|
kitten eating scum
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
I don't know. I have about 20 charcters on screen at once, and they don't give me any problems, even though I'm using the same code (I actually just changed it to only call AttemptMove once.) |
| Blog|EHS | |
![]() |
|
| Jerreldulay | Dec 1 2008, 04:18 AM Post #3 |
|
Advanced Member
![]() ![]() ![]() ![]() ![]()
|
Seriously? Well, hearing that makes me feel like I have some chance at making it work alright. The feasibility of my game was starting to fall through the floorboards since this issue started... Could the problem be with the height and hip_height values of my objects? I've been adjusting them to no end but the effects are seemingly unpredictable. I'm hoping someone can offer insight as to what I can adjust to get it all to work right. I seem to lose about 5-10 FPS for every character using the AttemptMoveTo, etc. etc. |
![]() |
|
| Eansis | Dec 2 2008, 08:59 PM Post #4 |
|
ghost
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
This happens because the gravity pushes the ellipsoids through the ground, forcing many iterations inside the collision procedure. Here is your egg collisions: ![]() As you can see you are forcing it to always apply the collisions, even when the base of the player is at the wanted distance. |
VOTE FOR BUDDY ROEMER HE'S A STRAIGHTFORWARD, DOWN TO EARTH AMERICAN GUY WHO ISN'T PART OF THE BIGBROTHER CONSPIRACY
| |
![]() |
|
| Eansis | Dec 9 2008, 08:59 PM Post #5 |
|
ghost
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
yeah skarik, i kind of dont know the math, at least we know the problem
|
VOTE FOR BUDDY ROEMER HE'S A STRAIGHTFORWARD, DOWN TO EARTH AMERICAN GUY WHO ISN'T PART OF THE BIGBROTHER CONSPIRACY
| |
![]() |
|
| Jerreldulay | Dec 11 2008, 01:33 AM Post #6 |
|
Advanced Member
![]() ![]() ![]() ![]() ![]()
|
Thanks! I'm very glad I know what's happening now. I've got to think up a way to kill the gravity when its not needed, right? |
![]() |
|
| Eansis | Dec 11 2008, 03:50 AM Post #7 |
|
ghost
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
nah its just a litle bit of math needed, to see the real distance from the ground the ellipsoid should be pushed, i dont know the exact formula for it, but im sure mysteriXYZ does, or Dr. Best maybe, if not, no need to worry, there are ways of finding out these things
|
VOTE FOR BUDDY ROEMER HE'S A STRAIGHTFORWARD, DOWN TO EARTH AMERICAN GUY WHO ISN'T PART OF THE BIGBROTHER CONSPIRACY
| |
![]() |
|
| Jerreldulay | Dec 11 2008, 05:11 AM Post #8 |
|
Advanced Member
![]() ![]() ![]() ![]() ![]()
|
Thanks heaps. I as hoping I'd find a logic-based method as opposed to a math-based method but I suppose math may be the most plausible route to take... I suck at math. |
![]() |
|
| Eansis | Dec 19 2008, 03:57 PM Post #9 |
|
ghost
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Okay I found the solution: (i'm suprised it took me this long to figure it out) have an ellipsoid with an origin near the chest, a radius equal to the distance from the chest to the head. This way the ellipsoid will not extend below the knees. The benefits to this are: Free movement on non-steep ramps Automatic mantling on surfaces lower than the knees Automatic steep ramp repulsion And more
|
VOTE FOR BUDDY ROEMER HE'S A STRAIGHTFORWARD, DOWN TO EARTH AMERICAN GUY WHO ISN'T PART OF THE BIGBROTHER CONSPIRACY
| |
![]() |
|
| Jerreldulay | Jan 6 2009, 03:43 AM Post #10 |
|
Advanced Member
![]() ![]() ![]() ![]() ![]()
|
Eanbro, interesting suggestion. It sounds like it makes sense but I'm not entire sure how to implement it. I've tried adjusting values of my ellipsoid but to no avail. Are you saying I should offset the origin of the whole thing? Thanks. |
![]() |
|
| skarik | Jan 6 2009, 04:01 AM Post #11 |
|
kitten eating scum
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
No, he means start at a higher position. Well, I think he does. You still have to expand it to touch the toes. |
| Blog|EHS | |
![]() |
|
| Eansis | Jan 6 2009, 09:29 PM Post #12 |
|
ghost
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
No. You should have the ellipsoid like this:![]() Ask Gandalf 20000, he got it to work. Edited by Eansis, Jan 6 2009, 09:29 PM.
|
VOTE FOR BUDDY ROEMER HE'S A STRAIGHTFORWARD, DOWN TO EARTH AMERICAN GUY WHO ISN'T PART OF THE BIGBROTHER CONSPIRACY
| |
![]() |
|
| Jerreldulay | Jan 6 2009, 11:53 PM Post #13 |
|
Advanced Member
![]() ![]() ![]() ![]() ![]()
|
Thanks heaps for all your time and help to everyone, I really appreciate it. I'll be spending time trying to get it working today and post results. I'll try Gandalf20000 if epic failure ensues. |
![]() |
|
| skarik | Jan 7 2009, 04:06 AM Post #14 |
|
kitten eating scum
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Hey, that reminds me of Stickman's old collision! I got rid of it because it let me climb slopes. |
| Blog|EHS | |
![]() |
|
| Reikyrr | Jan 7 2009, 09:10 PM Post #15 |
|
Forum God
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Your new collision lets me walk on a one pixel edge
|
|
~Inspirational quote~ | |
![]() |
|
| Go to Next Page | |
| « Previous Topic · Questions about Ultimate 3D · Next Topic » |
- Pages:
- 1
- 2





![]](http://z1.ifrm.com/static/1/pip_r.png)





10:20 AM Jul 11