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.

AppGameKit Classic Chat / the new physics character controller AGK 2.0.15b

Author
Message
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 1st Nov 2015 23:01
Can someone give me a small example of how to use Create3DPhysicsCharacterController correctly, seems it crashes when I try with...



Though I have no idea what values to put apart from the first param!
Hail to the king, baby!
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: 1st Nov 2015 23:43 Edited at: 1st Nov 2015 23:44
You can get the parameter descriptions for the command by double clicking the command name and press the F1 key which will open the help file in a browser.
Here is the link just in case.

https://www.appgamekit.com/documentation/Reference/3DPhysics/Create3DPhysicsCharacterController.htm
The coffee is lovely dark and deep,and I have code to write before I sleep.
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 1st Nov 2015 23:50 Edited at: 1st Nov 2015 23:52
Yeh I had done this,but have no idea what axis, objOffsetVec3, objOrientationVec3, mean as the 2nd,3rd and fourth parameter.
I appreciate it explains them but sill am clueless as they still lack any example
Hail to the king, baby!
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: 2nd Nov 2015 00:27 Edited at: 2nd Nov 2015 00:29
See the code example below for clarification.
The coffee is lovely dark and deep,and I have code to write before I sleep.
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 2nd Nov 2015 01:03 Edited at: 2nd Nov 2015 01:23
tried the code but seems to still crash! simply changine odjID with player (the name of my object)
*** edit ***
It crashes as soon as it hits the Create3DPhysicsCharacterController, the creating and deleting of vectors is fine, I even tried simply:




But still it crashes
Hail to the king, baby!
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: 2nd Nov 2015 02:49
Can you please provide the entire code for your project.
It will make it easier to diagnose the issue.
The coffee is lovely dark and deep,and I have code to write before I sleep.
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 2nd Nov 2015 07:39 Edited at: 2nd Nov 2015 08:21
no it wouldnt, I am trying it within my 3d editor! at the built in test level part, but everything else physics wise is working fine
**edit**
A small part of it I ripped out and changed:




This crashes on mine still
Hail to the king, baby!
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: 2nd Nov 2015 11:59
You can not use repeat, untill for the main loop in AGK. You must have a Do, Loop.
You also need to have a static physics object for the character controller to land on.
The starting position of your character object must be above the object it will land on.
The coffee is lovely dark and deep,and I have code to write before I sleep.
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 2nd Nov 2015 12:48
Since when have you had to use a Do Loop? ...just tested this, and Repeat Until appears to work fine:

V2 T1 (Mostly)
Phone Tap!
Uzmadesign
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: 2nd Nov 2015 13:28
Why are there DO LOOP commands?
The coffee is lovely dark and deep,and I have code to write before I sleep.
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 2nd Nov 2015 13:47
People use repeat - until as they think it's faster.
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 2nd Nov 2015 14:50
Quote: "as they think it's faster"


I just use the right type of loop for the job. A "Repeat Until" will iterate at least once before checking for the condition. A "While Endwhile" will do the check first meaning you can skip the contents of the loop entirely if the condition is not met. A "Do Loop" should be used when you know a perpetual loop is required. I wasn't aware of any performance differences between different types of loop, but would be interesting to find out!

V2 T1 (Mostly)
Phone Tap!
Uzmadesign
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 2nd Nov 2015 14:59
Search these forums, tests have been done and documented.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 2nd Nov 2015 17:15
DO / LOOP is not a requirement for the main game loop. You don't actually need any loop...but the code would be dire.
You shouldn't need something for the character controller to land on during the Create process. I'd be very surprised if it needed anything to land on at all, even during the simulation. Even if it did, it shouldn't crash.
Likewise, it doesn't need to be above anything.

I tested, and it crashed here too. It crashes on the create command
I tried an extra Sync and Physics step prior to it, in case it needed some setup to take place, but this didn't help.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 2nd Nov 2015 19:18 Edited at: 2nd Nov 2015 19:23
I do not usually use a do loop, it was just a quick example with the defaults! Also as I said I had to rip the bit out of my editor,which had plenty of static objects for it to 'land on' fact is it never gets chance anyhow coz it crashes on that creation of the controller command instantly.
Hail to the king, baby!
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: 2nd Nov 2015 23:24

Upon further testing it was determined that it is a random crash inside the Create3DPhysicsCharacterController() command.
When the width and depth of your object are the same it causes a variable to not be initialized and results in the crash.
I am submitting the fix to Paul. In the code snippet below I changed the X and Z dimensions of the box so they are not the same.
This is the current work around.


The coffee is lovely dark and deep,and I have code to write before I sleep.
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 3rd Nov 2015 10:46
I tried this code within my engine, but it makes the object I use as the player totally vanish, despite it being above static physics enabled objects, it no longer crashes though...
Hail to the king, baby!
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: 3rd Nov 2015 14:18
I have been unable to reproduce the crash you are having.
Could you create a code snippet that reproduces the crash?
The coffee is lovely dark and deep,and I have code to write before I sleep.
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 3rd Nov 2015 14:25 Edited at: 3rd Nov 2015 14:35
there is no crash, the object simply disappears as soon as the level is ran, the code is lengthy as I have done a 3d editor that has the ability to test the level within the editor, as soon as the character controller is added the object vanishes, it reappears when I exit back to the editor, remming out the chracter controller then has the object visible in both the editor and on testing the level.

I will try to code an example outside of the editor.
Hail to the king, baby!
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: 3rd Nov 2015 14:37
Can you try using the command Debug3DPhysicsCharacterController() which will show the physics object for the controller.
If the character controller is created successfully you should see the physics capsule.
The coffee is lovely dark and deep,and I have code to write before I sleep.
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 3rd Nov 2015 14:55 Edited at: 3rd Nov 2015 14:59
okay,it must be something on my part, I have at least something that does not disappear, though the thing keeps bouncing!


Hail to the king, baby!
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: 3rd Nov 2015 16:01
To stop the bouncing there are 2 options.
1. make your object box taller than it is wide or deep.
2. change the axis to a z axis which is your largest dimension. For example Create3DPhysicsCharacterController(obj, 2, characterOffsetVec, objectOrientationVec, 0.75 )
The coffee is lovely dark and deep,and I have code to write before I sleep.
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 3rd Nov 2015 16:15
right, tnx for that, I chose the latter option, but there seems to be a gap between the object controller and the object for the floor:



Hail to the king, baby!

Login to post a reply

Server time is: 2024-09-29 07:28:28
Your offset time is: 2024-09-29 07:28:28