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 Studio Chat / 'Very simple' Vehicle Physics - Question..

Author
Message
Rick Nasher
2
Years of Service
User Offline
Joined: 25th Jul 2017
Location: Amsterdam
Posted: 1st Dec 2019 12:08 Edited at: 1st Dec 2019 12:14
@blink0k and fubarpk

As you guys have been deep into this, (see: Very simple kart physics and Basic Car Physics ), I have a question:

Is it possible to add a 2nd carriage, hinged to the vehicle that's used by the character controller?


I'm asking for I wanted to quickly create a little x-mas thing like a Santa's sled being pulled by a reindeer(the main vehicle).

I'd figured it would be simple to attach 'the carriage' (a flat cube) to the kart using a hinge(as in physics examples) and then change the kart into a very basic brown blocky thing representing a reindeer , but during experiments I got all kind of weird behavioral things. Not really clear to me what would be the correct workflow/order of things for this kinda stuff.

Of course I can do it without physics, but it would look way less cool, than having the sled sliding from side to side in sharp corners. Any help is appreciated.
blink0k
AGK Developer
6
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 2nd Dec 2019 04:10 Edited at: 2nd Dec 2019 04:10
Hopefully this will do the trick for you. I know i had a santa/sleigh hanging around somewhere. If i get a chance i'll have a bit of a look for it

Attachments

Login to view attachments
Rick Nasher
2
Years of Service
User Offline
Joined: 25th Jul 2017
Location: Amsterdam
Posted: 2nd Dec 2019 19:23
Thanks very much blink0k, but there seem to be missing 2 includes. One is for scancodes(no problem, have that) the other is regarding constants, which is more tricky and custom.
I'll try and see if can do without.
fubarpk
Moderator
14
Years of Service
User Offline
Joined: 11th Jan 2005
Location: Adelaide
Posted: 2nd Dec 2019 19:36
I haven't tried it yet but it may use his older constants file

fubarpk
fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
Rick Nasher
2
Years of Service
User Offline
Joined: 25th Jul 2017
Location: Amsterdam
Posted: 2nd Dec 2019 19:55
Hehehe, tried that already. Missing some types and perhaps more.
Rick Nasher
2
Years of Service
User Offline
Joined: 25th Jul 2017
Location: Amsterdam
Posted: 2nd Dec 2019 20:04
Found the missing piece was:

blink0k
AGK Developer
6
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 2nd Dec 2019 21:43 Edited at: 2nd Dec 2019 21:45
I always forget that stuff. I've attached it. Sorry about that
Couple of things;
1. It doesn't swing about much and i thought if you had a bar between he two shapes and made a hinge joint at each end it would be much more hectic
2. I think it's a great idea
2.1 I found a santa sleigh


2.2 I though a reindeer driving a car might be cool

Attachments

Login to view attachments
Rick Nasher
2
Years of Service
User Offline
Joined: 25th Jul 2017
Location: Amsterdam
Posted: 3rd Dec 2019 23:27 Edited at: 3rd Dec 2019 23:57
Ghegheghe, also cool blink0k.

Swinging of the carriage is ok by me, However when the (imaginary) "reindeer stops running" , the carriage spins right trough the poor deer.


As the carriage and kart are one, I don't think there's a way to give it more friction and/or limit the angles?

What I had originally in mind were things like:


or:



But not sure how and where to apply such things..
I had some minor succes attaching the pivot cone to it as a test, but doesn't behave as expected.

I'm afraid I do not have enough experience/knowledge of the whole physics stuff. Only have a basic understanding from the examples that came with AGK. As documentation is sparse, I'm wondering where you guys got the info required to get this far?
fubarpk
Moderator
14
Years of Service
User Offline
Joined: 11th Jan 2005
Location: Adelaide
Posted: 4th Dec 2019 01:15 Edited at: 4th Dec 2019 01:15
Im not sure how blink managed that with one object
but you could add side bumpers to the car as attached separate objects
and the physics would make it bounce off the sides
fubarpk
fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
blink0k
AGK Developer
6
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 4th Dec 2019 01:59 Edited at: 4th Dec 2019 05:49
Create3DPhysicsHingeJoint( jamCylinder, doorBox, hingePos, hingeRot, 1 ) the one should be zero
Quote: "disableCollisions - 1 = collisions will be disabled between linked objects, 0 collisions will be enabled between linked objects."


Also Set3DPhysicsJointHingeLimits()


Santa done crashed!

Attachments

Login to view attachments
Rick Nasher
2
Years of Service
User Offline
Joined: 25th Jul 2017
Location: Amsterdam
Posted: 4th Dec 2019 11:55
That's looking mighty funny, well done!

Thanks for the pointers, I'll delve into it..
Rick Nasher
2
Years of Service
User Offline
Joined: 25th Jul 2017
Location: Amsterdam
Posted: 4th Dec 2019 17:10 Edited at: 4th Dec 2019 22:42
@blink0k
I was thinking below would then do the trick, but as soon as I uncomment the last line, at launch AppGameKit processes the code and closes without any error, so clueless still.. (bit of a pity it doesn't really expresses what's the problem or even report anything).

That's why I was wondering, if at all possible and above code + approach is correct, where to have this in the code. I thought after vehicle = LoadVehicle("suv", "vehicle.png") or in that function itself, but neither of these(or other tests) seem to make any difference, so kinda stuck.



@fubarpk
Quote: "Im not sure how blink managed that with one object"

I know, he's kind of a 3d-wizard or something!

Quote: " but you could add side bumpers to the car as attached separate objects and the physics would make it bounce off the sides"

That immediately sprang to mind, but would be a bit of kludge I think and want to do it he 'proper' way, also for educational purposes. But perhaps it's a nogo, won't work they way I'm hoping it would.
Rick Nasher
2
Years of Service
User Offline
Joined: 25th Jul 2017
Location: Amsterdam
Posted: 5th Dec 2019 07:36 Edited at: 5th Dec 2019 07:40
Woops... You already actually put it all in there already. Just had to look into MoveVehicle code(which I for some reason disregarded). (yes, I've just called myself an embarrassed,cross-eyed, old man) lol , while "I should be in school!"

That was rather silly of me to think I actually had to do something myself!
Absolutely great stuff blink0k, many, many thanks.


EDIT:
I've only found *after* I realised should be using vehicle.hit and started to look for this in the code.
Rick Nasher
2
Years of Service
User Offline
Joined: 25th Jul 2017
Location: Amsterdam
Posted: 5th Dec 2019 07:46 Edited at: 5th Dec 2019 07:51
Found this one is even more fun:
Create3DPhysicsConeTwistJoint( vehicle.hit, vehicle.trailer, vehicle.tpVector, vehicle.trVector, 0)

Perhaps not so suitable for Santa, but oh-oh the things we can do with this.. ;-D

Or
coneTwistJoint = Create3DPhysicsConeTwistJoint( vehicle.hit, vehicle.trailer, vehicle.tpVector, vehicle.trVector, 0)
Set3DPhysicsJointConeTwistLimits( coneTwistJoint, 15, 15, 36 )
blink0k
AGK Developer
6
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 5th Dec 2019 08:19
You have a message

Login to post a reply

Server time is: 2019-12-12 06:09:08
Your offset time is: 2019-12-12 06:09:08