Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / ObjectSphereSlide, sliding to fast

Author
Message
hoyoyo80
8
Years of Service
User Offline
Joined: 11th May 2016
Location:
Posted: 27th Feb 2018 06:10
Hi all,

Im making a character movement.
I use joystick value to determine angle on which the player will face using atan2 and using a value in MoveObjectLocalZ.
Collision with raycast run fine until i decided to use objectsphereslide when player hit the wall and i still want it to move. But the result, the character slide too fast, even faster then the movement speed.

Help me, thanks

GarBenjamin
AGK Developer
7
Years of Service
User Offline
Joined: 30th Nov 2016
Location: USA
Posted: 27th Feb 2018 13:46 Edited at: 27th Feb 2018 13:47
I ran into this and also a bounceback effect instead of a true slide. My solution is to take the weighted average of old position + new position returned by slidingcast. The exact code is near the bottom of the main.agc file in the project source in the old school fps thread. Check out the latest source from latest post.

I think basically I ended up doing (oldx*3 + newxReturnedBySlide)/4 and (oldz*3 รท newzReturnedBySlide)/4. To get the average with the old position having more weight. This solved the bounceback fx and it also fixed the speedup during sliding.
TI/994a (BASIC) -> C64 (BASIC/PASCAL/ASM/Others) -> Amiga (AMOS/BLITZ/ASM/C/Gamesmith) -> DOS (C/C++/Allegro) -> Windows (C++/C#/Monkey X/GL Basic/Unity/Others)
hoyoyo80
8
Years of Service
User Offline
Joined: 11th May 2016
Location:
Posted: 28th Feb 2018 00:58
Wow! Glad to hear that! I look into the your game. Thanks
hoyoyo80
8
Years of Service
User Offline
Joined: 11th May 2016
Location:
Posted: 28th Feb 2018 03:02
Ok, ive look into your example,implement it and it worksThanks

Actually i don't know how this thing works,can somebody care to explain?
GarBenjamin
AGK Developer
7
Years of Service
User Offline
Joined: 30th Nov 2016
Location: USA
Posted: 28th Feb 2018 20:20 Edited at: 28th Feb 2018 20:22
If by "thing" you mean my code... I just looked at the behavior I got from directly using the x and z values returned by ObjectSphereSlide. In my case, it was obvious the values were causing a bounceback effect and then a speed increase.

So I just solved it by taking a weighted average of the new coords returned by ObjectSphereSlide and the camera's (i.e. object's) position before moving and this corrected the behavior. Eventually. Actually as the comments document I iterated on this several times.

Not sure why ObjectSphereSlide returned the values it returned but at least they were consistent in causing the unwanted behavior and that made it possible to fix it. I'm guessing it has something to do with the size of the collider but as long as I can make it work I am content so moved on to other features.
TI/994a (BASIC) -> C64 (BASIC/PASCAL/ASM/Others) -> Amiga (AMOS/BLITZ/ASM/C/Gamesmith) -> DOS (C/C++/Allegro) -> Windows (C++/C#/Monkey X/GL Basic/Unity/Others)
hoyoyo80
8
Years of Service
User Offline
Joined: 11th May 2016
Location:
Posted: 11th Mar 2018 13:20
Thanks GarB, what i meant is how the command works. Im still tweaking it, sometime my mesh go thru the wall
Blendman
10
Years of Service
User Offline
Joined: 17th Feb 2014
Location: Arkeos
Posted: 11th Mar 2018 15:32 Edited at: 11th Mar 2018 15:43
Hi

I have a big matter using ObjectSphereSlide ( ) : its the y coordinnates.
For exemple, for a ground with lots of little variations, my character is often blocked or he jump, even if i dont want.

Do you know a way to fixe that ?
AGK2 tier1 - http://www.dracaena-studio.com
Stab in the Dark software
Valued Member
21
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 13th Mar 2018 14:14
You could just use the 3D physics character controller as it handles all of this for you.
The coffee is lovely dark and deep,and I have code to write before I sleep.
GarBenjamin
AGK Developer
7
Years of Service
User Offline
Joined: 30th Nov 2016
Location: USA
Posted: 14th Mar 2018 03:37
Well like he ^^^ said... if there are actually character controllers in AGK2 that might be your simplest solution. Otherwise, I'd have to see a demo program of what you are describing and see what the behavior is exactly. Then once we know what is happening can work on designing a solution to correct it. Although you might find just taking the average of the current y (weighted) + the y returned by ObjectSphereSlide may correct it.
TI/994a (BASIC) -> C64 (BASIC/PASCAL/ASM/Others) -> Amiga (AMOS/BLITZ/ASM/C/Gamesmith) -> DOS (C/C++/Allegro) -> Windows (C++/C#/Monkey X/GL Basic/Unity/Others)
Stab in the Dark software
Valued Member
21
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 14th Mar 2018 21:51 Edited at: 14th Mar 2018 21:59
Quote: "if there are actually character controllers in AGK2"


The coffee is lovely dark and deep,and I have code to write before I sleep.
GarBenjamin
AGK Developer
7
Years of Service
User Offline
Joined: 30th Nov 2016
Location: USA
Posted: 15th Mar 2018 17:59 Edited at: 15th Mar 2018 18:00
Ha ha! Okay thanks. I've never personally had any interest in the canned physics systems in game engines but I know that a lot of people like that stuff and even expect it to be included in any game dev platform these days so it is great AppGameKit has it!
TI/994a (BASIC) -> C64 (BASIC/PASCAL/ASM/Others) -> Amiga (AMOS/BLITZ/ASM/C/Gamesmith) -> DOS (C/C++/Allegro) -> Windows (C++/C#/Monkey X/GL Basic/Unity/Others)
Stab in the Dark software
Valued Member
21
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 15th Mar 2018 21:56
Quote: "I've never personally had any interest in the canned physics systems in game engines"


I would not really consider it a "canned physics system" as it uses the Oscar winning Bullet Physics engine.
Lets get the word out that AppGameKit has a good physics engine for 2d and 3D physics.

The coffee is lovely dark and deep,and I have code to write before I sleep.
GarBenjamin
AGK Developer
7
Years of Service
User Offline
Joined: 30th Nov 2016
Location: USA
Posted: 16th Mar 2018 02:27 Edited at: 16th Mar 2018 05:42
Well by canned I just mean already made existing there to be used * and not that it is a bad thing in anyway. I like to handle that stuff myself and quite likely don't work on any games ambitious enough to make the amount of effort implementing my own physics push me over to use these physics systems. Lol

I agree with you. I always speak (well type) highly about AGK2 in general. Used to mention it on the Unity forums fairly often when posting about current projects and I've made videos on my work in it. They don't get thousands of views each but they get dozens and maybe someone will be introduced to AGK2 from one of those.

Anyway, I think AGK2 is awesome all around. And with it also having the physics systems included it should be far more popular than it is. To attract the Unity and Unreal folks they need to focus on graphics particularly lighting & shadows.

So... I guess if TGC hires a lighting graphics pro to update the graphics system that might make the product really take off. Although I have noticed a good number of new people showing up here in the past year! So that is a great thing.

* NOTE: I should say I am not making light of the work they put into integrating these physics systems into the product. I am sure it was a good amount of work!
TI/994a (BASIC) -> C64 (BASIC/PASCAL/ASM/Others) -> Amiga (AMOS/BLITZ/ASM/C/Gamesmith) -> DOS (C/C++/Allegro) -> Windows (C++/C#/Monkey X/GL Basic/Unity/Others)
Blendman
10
Years of Service
User Offline
Joined: 17th Feb 2014
Location: Arkeos
Posted: 16th Mar 2018 10:25
Hi

I use character and physics in most of my 3D games (cartoon plartformer, action, rpg...). Those features are amazing, but it's a lot of work to create the level design with physics ^^.

So, because with ObjectSphereSlide(), it's easier and quicker (no need to create physics body), I just would like if it's possible to not have the player jump on the ground when the ground has little variation.
if not, I will use the physics and character . I think it's better and more stable & precise.
AGK2 tier1 - http://www.dracaena-studio.com
Stab in the Dark software
Valued Member
21
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 16th Mar 2018 13:30
Quote: "* NOTE: I should say I am not making light of the work they put into integrating these physics systems into the product. I am sure it was a good amount of work!"


I have a really good idea of the amount of work as I was the one who did it.


Quote: " I just would like if it's possible to not have the player jump on the ground when the ground has little variation."


Have you tried "Set3DPhysicsCharacterControllerStepHeight( objID, stepHeight ) ".

The coffee is lovely dark and deep,and I have code to write before I sleep.
GarBenjamin
AGK Developer
7
Years of Service
User Offline
Joined: 30th Nov 2016
Location: USA
Posted: 16th Mar 2018 15:01 Edited at: 16th Mar 2018 17:00
@Blendman it sounds like for your requirements it would be much better to just use the physics system and character controller. I am not familiar with how it is implemented here but I have used a character controller in (a game engine) and like @Stab in the Dark software said just increasing the step height should allow the player character to move across the terrain interacting with the ground and not getting stuck. It is basically a setting of how high the obstacle needs to be or how great the angle is (forgot now and maybe there are parameters for both) to block movement.

The nice thing about the character controller (at least the one I used) is that it just worked and yet I was not locked into using actual physics stuff for everything such as adding forces and so forth that would completely change how I develop. Maybe it is the same here and you will get best of both worlds.
TI/994a (BASIC) -> C64 (BASIC/PASCAL/ASM/Others) -> Amiga (AMOS/BLITZ/ASM/C/Gamesmith) -> DOS (C/C++/Allegro) -> Windows (C++/C#/Monkey X/GL Basic/Unity/Others)
hoyoyo80
8
Years of Service
User Offline
Joined: 11th May 2016
Location:
Posted: 16th Mar 2018 23:13
Quote: "I use character and physics in most of my 3D games (cartoon plartformer, action, rpg...). Those features are amazing, but it's a lot of work to create the level design with physics ^^"

Interested with the statement...care to share what with the level design? Before i jump into 3d physic..
Blendman
10
Years of Service
User Offline
Joined: 17th Feb 2014
Location: Arkeos
Posted: 25th Mar 2018 17:54
Hi
I have seen its not possibleto movethe character in 2 directions t the same time (without rotate it), like in a lot of 3d ggme (war robots, gun of booms, 3d platformer...).

Is there a way to move it in 2d directions ? Because, like that, i cant use character and physics in some of my 3d games and i really would like to use it.
AGK2 tier1 - http://www.dracaena-studio.com
Stab in the Dark software
Valued Member
21
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 25th Mar 2018 21:25
Contact Rick or Paul and tell them you need it fixed.
The coffee is lovely dark and deep,and I have code to write before I sleep.

Login to post a reply

Server time is: 2024-11-23 01:14:40
Your offset time is: 2024-11-23 01:14:40