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 / Move3DPhysicsCharacterController : not possible in 2 directions ???

Author
Message
Blendman
10
Years of Service
User Offline
Joined: 17th Feb 2014
Location: Arkeos
Posted: 25th Mar 2018 17:04
Hi

I use a 3D character physics, and Move3DPhysicsCharacterController() to move it (forward, backward, left, right) and mouse to rotate it, like in a lot of 3D game.

But How can I move the character in 2 directions at the same time ( ex: left & forward).

What I have tried, but it doesn't work , only 1 direction works.



Do you know how I can move my character in 2 directions at the same time (without rotate it of course) ?

Thank you.
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:23
It was not set up that way.Paul would need to change it so that you can.
The coffee is lovely dark and deep,and I have code to write before I sleep.
Blendman
10
Years of Service
User Offline
Joined: 17th Feb 2014
Location: Arkeos
Posted: 26th Mar 2018 08:54
ok, I will ask if they can add this feature, because it's very important for 3D games. It's strange it was not implemented when they have added the character system which is great ^^.


Do you know a way to know with what object is the character in colision ?

I would like to know if the character is on an object (groud, platform) or colide with a bonus -object, or no object (so he's jumping).
I would like to create a double jump, but I need to know if the character is jumping ^^. I don't know if it's possible.

I have tried ObjectSphereCast(0, oldx, oldy, oldz, newx, newy, newz, Player.w) but it doesn't work properly (because my character isn't a sphere ^^).

Thanks
AGK2 tier1 - http://www.dracaena-studio.com
Rick Nasher
7
Years of Service
User Offline
Joined: 25th Jul 2017
Location: Amsterdam
Posted: 26th Mar 2018 20:33
Really hope they'll add more 3d physics stuff like the vehicle physics for cars, boats & planes. It would make it a complete game environment.
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: 27th Mar 2018 16:17
Quote: "I would like to know if the character is on an object (groud, platform) or colide with a bonus -object, or no object (so he's jumping).
I would like to create a double jump, but I need to know if the character is jumping ^^. I don't know if it's possible."


Look at the contacts report demo here.

https://forum.thegamecreators.com/thread/216683

Quote: "Really hope they'll add more 3d physics stuff like the vehicle physics for cars, boats & planes. It would make it a complete game environment."


I do not think that will ever happen.
The coffee is lovely dark and deep,and I have code to write before I sleep.
PHeMoX
6
Years of Service
User Offline
Joined: 9th Jan 2018
Location:
Posted: 27th Mar 2018 17:55
Quote: "ok, I will ask if they can add this feature, because it's very important for 3D games. It's strange it was not implemented when they have added the character system which is great ^^.
"


I fully agree with you. I did manage to kind of get it to work using rotate3DPhysicscharactercontroller in combination with move3DPhysicscharactercontroller. But why not allow for diagonal strafing? It makes little sense indeed. Or rather, it feels very rudimentary.

Quote: "I would like to create a double jump, but I need to know if the character is jumping ^^. I don't know if it's possible."


I'm not sure you can do double jumps using the character physics controller Jump command, because as far as I know we can't really override the starting height to something like max first jump height + second jump height style calculating.
GarBenjamin
AGK Developer
7
Years of Service
User Offline
Joined: 30th Nov 2016
Location: USA
Posted: 28th Mar 2018 00:32 Edited at: 28th Mar 2018 00:37
@Blendman you can just write your own code for that stuff. I don't think a "normal" (as in stock) character controller can track or be aware of things such as double jumps, sliding, wall climbing or any of the many other possibilities. People generally write their own custom character controllers around the built-in CCs to handle this kind of stuff as far as I know.

Just set a variable isJumping to true when the character jumps. In the update loop if isJumping is true check to see if character is still moving up. If not then clear IsJumping. You could also increment isJumping each frame to track how long the character has been moving up. Or you can store ypos at start of jump and look at current ypos and again use this for the range / window of time. So if there is a window of time for the double jump to happen you can check if the character is within that window and if jump is pressed again initiate the second jump. Apply a force, start a somersault animation etc.

Not sure if the physics system can tell you current velocity of the character but if it cannot just track oldYpos at the end of each frame and compare currentY to oldY and you know if they are still moving up (i.e. still in jumping state).
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 Mar 2018 04:07
Does this mean the 3d physic controller is not complete?

I hvnt invest in physic yet,not mentally ready.
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: 28th Mar 2018 19:58
Quote: "Does this mean the 3d physic controller is not complete?"


Paul just needs to change it so it takes a direction vector in stead of hard coded values.
Paul assumed users would not under stand direction vectors.
The coffee is lovely dark and deep,and I have code to write before I sleep.
PHeMoX
6
Years of Service
User Offline
Joined: 9th Jan 2018
Location:
Posted: 28th Mar 2018 22:14
Yeah, the problem is not the IsJumping part. We can already check that by adding a flag manually, which is useful for stamina bars and so on. However, each new jump does seem to rely upon a collision with the ground that is indeed providing a hardcoded value for the starting height of the jump. We can't add an offset to it in order to do double jumps.

Nothing wrong with the physics controller right now in terms of completion necessarily, however it is definitely limited in some ways.

Quote: "Not sure if the physics system can tell you current velocity of the character but if it cannot just track oldYpos at the end of each frame and compare currentY to oldY and you know if they are still moving up (i.e. still in jumping state)."


Unfortunately we can not use :

SetObject3DPhysicsLinearVelocity( player, vectorID, speed )

nor

GetObject3DPhysicsLinearVelocityY( player )

when the player object here is a physics character controller... The physics character controller is not a regular physics body, so it will give an error.

I think at the moment double jumps using the physics character controller are not possible. Maybe using some work-around trick spawning invisible blocks underneath your character which do get detected by the second time you start a physics character controller jump. But I kind of doubt it. It seems hardcoded.
GarBenjamin
AGK Developer
7
Years of Service
User Offline
Joined: 30th Nov 2016
Location: USA
Posted: 28th Mar 2018 23:42 Edited at: 28th Mar 2018 23:46
Ah okay sorry for my rambling then. I misunderstood.

When you say it seems to be using a hardcoded value... do you mean the character controller directly supports jumping but does not allow you to specify the jump force/velocity? As in all jumps are the same except reducing mass/gravity would allow a higher jump I'd guess.

I generally steer away from this kind of stuff but I will have to check it out sometime.
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)
PHeMoX
6
Years of Service
User Offline
Joined: 9th Jan 2018
Location:
Posted: 29th Mar 2018 13:14 Edited at: 29th Mar 2018 13:16
No worries. You were thinking what I was thinking, but unfortunately those commands aren't supported in combination with the physics character controller.

The hardcoded value I'm talking about is purely the starting height of each jump that seems to require a collision with a surface below; it sets that as it's fixed starting height, before it can trigger another jump using the physics character controller 'jump' command. We can set the jump speed and gravity etc. , so we can control parts of the jump.

However we can not feed a jump in progress with a new 'surface starting height' so to speak to create a double jump. Instead the jump will need to finish it's fall, collide with a (new or same) surface before you can jump again from said new surface height.

In practice this means you can jump on a chair and then jump on a table without issues (assuming you're using some appropriate values for speed and gravity), however a 'double jump' to land on the table straight away from a ground surface can't be done. For that you'd need to use a stronger jump speed, which affects all jumps. And as a double jump usually is only engaged mid-air, there's no way to do so as we can not 'overwrite' the surface ground height the jump command uses. We also can not really interrupt a jump.

I haven't tried using dynamic jump speeds based on for example holding a key, so I'm not sure how flexible the jump speed command is there during a jump. But I'd expect there is a chance it is not very flexible.
Blendman
10
Years of Service
User Offline
Joined: 17th Feb 2014
Location: Arkeos
Posted: 29th Mar 2018 13:50
Hi

For the double with character, i have made this and it work fine :
- first jump, set a flag jump =1, he jump only if jump <=1
- second jump jump =2, create a box invisible under the feet of plarer, and he jump on this box. When jump, delete this box.

For me it works fine, i have a double jump with character on my 3d platformer-action.

For the other things, like collect bonus, i use a spherecast which works too now.

Is the character body made with 3 physics objects ?
AGK2 tier1 - http://www.dracaena-studio.com
PHeMoX
6
Years of Service
User Offline
Joined: 9th Jan 2018
Location:
Posted: 3rd Apr 2018 18:10
There is a downside to the invisible box trick though; because AppGameKit or at least its physics system really doesn't like spawning physics objects into other physics objects. So in a room filled with boxes, chairs and so on, all physics objects, you can get some really funky results with objects shooting into 'outer space'. The other problem is removing the box and the timing when no double jump is activated. The character should fall without a collision.

So far I have only gotten mediocre results, so gave up on the invisible box trick for now.

Login to post a reply

Server time is: 2024-11-24 10:03:07
Your offset time is: 2024-11-24 10:03:07