Playmaker Forum

PlayMaker Feedback => Action Requests => Topic started by: blackant on May 11, 2014, 02:53:55 PM

Title: Wheel colliders[SOLVED]
Post by: blackant on May 11, 2014, 02:53:55 PM
Maybe i'm wrong but it seems that there is no possibility to get and set some parameters of the wheel collider physic object.

i'm actually testing some way to dynamicly changes parameters like Stifness Factor, i don't see it appearing in the list of variables in set/get property action.
Title: Re: Wheel colliders
Post by: 600 on June 30, 2014, 11:21:01 AM
Hello Playmaker world  :)


blackant:
SetWheelColliderProperties
http://hutonggames.com/playmakerforum/index.php?topic=3981.0


Under this topic I would like to add a request regarding wheels.
Im trying to set mesh of a wheel to follow the suspension.
There is a function GetGroundHit(hit: WheelHit) in Unity docs, please check:

http://docs.unity3d.com/ScriptReference/WheelCollider.GetGroundHit.html
http://docs.unity3d.com/ScriptReference/WheelHit.html

Anthing like this done in Playmaker before? I was thinking of using raycast for each wheel to check the ground point and move the mesh accordingly, but this would take much performance no?

Whats your experience?
Thanks
Title: Re: Wheel colliders
Post by: jeanfabre on July 16, 2014, 07:13:20 AM
Hi,

 it depends that you are after once you got the info that the wheel has hit the ground.

 Can you expand a bit on what you are after?

 Bye,

 Jean
Title: Re: Wheel colliders
Post by: 600 on July 16, 2014, 10:22:46 AM
Hi, thanks for your insight,

3d platform, trying to move wheel meshes up/down by following wheelcolliders.
Wheel colliders dont move up/down them selves, instead they bounce with its ray.
So I cant parent meshes to colliders.
I have tried getCollision info and collision enter, but they are something different I guess.

Idea to do this:

(picture A)
if wheelcollider isGrounded(get Property) = False,
the wheel mesh moves -Y self space x amount (like when a car is in air suspension is released)

(picture C)
if True - I could use the colliders in-built ray to get GroundHit point Y and move the mesh up/down.

Thanks
Title: Re: Wheel colliders
Post by: 600 on August 05, 2014, 06:29:24 AM
bump

Hi, may I hear an opinion on this please?
Thanks
Title: Re: Wheel colliders
Post by: jeanfabre on August 05, 2014, 07:15:17 AM
Hi,

 You should totally go for a custom behavior or actual framework if you start messing with wheels... Unless you know excatyl how wheels collider is working, and it's indeed very tricky to get right.

 Typically, download the "Samples Assets ( beta)" from the asset store and in there you'll have a very well down Wheel component, that even allow you to conveniently align the wheel collider with your wheel mesh for you. so it's really powerful, and works straight away out of the box.

Typically, the wheel model should simply follow the wheel collider transform, without any fancyness.
[EDIT] I was so wrong... It's actually very tricky, and a series of custom actions would need to be done for this. I'll see if I can make a  convenient wrapper for this to be done automatically. Can you bump me sometime next week and I'll work on this.

 Bye,

 Jean
Title: Re: Wheel colliders
Post by: 600 on August 05, 2014, 07:30:23 AM
Thank you thank you thank you!

Will bump, no rush :)

Title: Re: Wheel colliders
Post by: 600 on August 14, 2014, 01:22:20 AM
bump :)
Title: Re: Wheel colliders
Post by: jeanfabre on August 14, 2014, 02:06:49 PM
Hi,

 Can we post pon that until beginning of september? I am flying to Unite this week end, and then I have PAX to attend with a client, so august is pretty much done for me...

Bye,

 Jean
Title: Re: Wheel colliders
Post by: 600 on August 14, 2014, 02:09:28 PM
Hi,
Sure no problem,
good luck!
Title: Re: Wheel colliders
Post by: 600 on September 23, 2014, 03:13:58 AM
bump :)
Title: Re: Wheel colliders
Post by: jeanfabre on September 23, 2014, 04:25:15 AM
Hi,

 tricky, cause Unity 5 has a total revamp of its physics, and it's way better.

 I would suggest you use a framework for this where the author gives you all the wrappers and proper wheel behavior you rwould expect. This is actually something that Unity guys strongly encourage as opposed to work from scratch with a raw wheel collider, which is hard.

Bye,

 Jean
Title: Re: Wheel colliders
Post by: 600 on September 23, 2014, 04:48:01 AM
Hi, thanks for the reply,

Will look at Unity5, maybe its a good idea to wait and then decide how to act.
Meanwhile will try other ideas how to "cheat" suspensions visuals.
Actual wheel collider is working good, bouncing, sliding, moving the car.

Will report how this ends, the goal is to make much as possible in Playmaker :)
Title: Re: Wheel colliders
Post by: 600 on October 03, 2014, 07:54:45 AM
Hello,

reporting in about those wheels,
please see video bellow, the setup for the car is working great with wheel colliders detects the suspension. Here I added a raycast for wheel meshes to animate suspension.
Now the setup is double, because of mesh raycasts and wheel colliders built-in raycast.

Any possible chance to get a property from a wheel colliders ray where did he hit something?
Like getGroundHit ? To avoid adding an extra ray.

Jean, you mentioned that it needs a series of custom actions, does that apply on that ground hit thing or wheels in general?

Thanks for looking into this.

Title: Re: Wheel colliders
Post by: jeanfabre on November 07, 2014, 02:45:56 AM
Hi,

 ok, sorry for the delay, slowly catching up.

 Can you try these two actions, they are available on the Ecosystem (https://hutonggames.fogbugz.com/default.asp?W1181):

GetWheelColliderGroundHitProperties (https://github.com/jeanfabre/PlayMakerCustomActions_U3/blob/master/Assets/PlayMaker%20Custom%20Actions/Physics/GetWheelColliderGroundHitProperties.cs)

GetWheelColliderisGrounded (https://github.com/jeanfabre/PlayMakerCustomActions_U3/blob/master/Assets/PlayMaker%20Custom%20Actions/Physics/GetWheelColliderIsGrounded.cs)

 Bye,

 Jean
Title: Re: Wheel colliders
Post by: 600 on November 07, 2014, 04:18:17 AM
Wooaaa Thanks for your input!

But I cant get any info out of them, both actions returns False in bools or zeros in other variables.
Seems actions don't recognize that owner or specific gameobject have wheel collider component?

At first Unity run I got a warning in console that in Ground Hit properties action there are Int var that isn't assigned, but after Unity restart it was gone and cant get it to warn me again, so other than that no errors.


EDIT:

This warning:

Assets/PlayMaker Custom Actions/GetWheelColliderGroundHitProperties.cs(95,30): warning CS0219: The variable `hit' is assigned but its value is never used
Title: Re: Wheel colliders
Post by: jeanfabre on November 11, 2014, 02:21:52 AM
Hi,

 don't worry about the warning, I'll fic this, it doesn't affect the behavior.

 I'll run some tests, it was blind coding. Please bump towards the end of the week if you don't hear from me.

 Bye,

 Jean
Title: Re: Wheel colliders
Post by: 600 on December 02, 2014, 01:04:35 PM
bump :)
Title: Re: Wheel colliders
Post by: jeanfabre on December 05, 2014, 01:45:11 AM
Hi,

 This is done (https://github.com/jeanfabre/PlayMakerCustomActions_U3/blob/master/Assets/PlayMaker%20Custom%20Actions/Physics/GetWheelColliderGroundHitProperties.cs), I forgot to mention it here.


 Bye

 Jean
Title: Re: Wheel colliders
Post by: 600 on December 05, 2014, 06:01:07 AM
Hi!

Thanks for the link! The warning is gone.

Sorry to bug you again, but I cant get any value out, actions wont react on wheel collider movement and touching the ground.

Am I missing something?

Tried new scene/project/Unity reinstal.

Thanks!
Title: Re: Wheel colliders
Post by: 600 on July 08, 2015, 11:37:36 AM
Hi, action "GetWheelColliderGroundHitProperties" was not giving any values out, copied "return" below "if's" and now it works, without stoping the Play mode now gives 2 errors, please check images below.
What does it mean?
Thanks!
Title: Re: Wheel colliders
Post by: doppelmonster on July 13, 2015, 04:50:04 AM
Hi nila,

the original code was written to stop if there is no game object referenced (to prevent a reference missing error).

Now you changed the code so it will execute (give you values) even when the gameobject/component is empty (missing). 

Do you get the error message when reaching this action in runtime or after saving the script?

It looks like you have a basic problem with the gameobject/component reference as you didnt get values with the original code.

I have just very basic programming knowledge. so take this advice with a grain of salt.
Title: Re: Wheel colliders
Post by: 600 on July 13, 2015, 08:25:52 AM
Hi, thanks for looking in to this,

after saving the script there are no errors, they show up in runtime.
I made this edit with no programming experience, just experimenting replacing lines looking at other actions :)

The original action returns zero and none in all times,
with this edit I can get the right values (action reacts), but with errors.

If I leave the “return” as default, seems it gives zero values because it skips “if” states below, that made me put the “return” after them.
Title: Re: Wheel colliders
Post by: jeanfabre on July 17, 2015, 05:02:18 AM
Hi,

 ok, I have updated and fixed that action, now it will throw a warning instead of error ( I reported to Unity, it's a bug, the first time the collider value is null... which is wrong because it's a hit indeed...)

 I also made that action available on the Ecosystem (https://hutonggames.fogbugz.com/default.asp?W1181), so you can get it directly there now.


Bye,

 Jean
Title: Re: Wheel colliders
Post by: 600 on July 17, 2015, 05:15:49 AM
Yes! Super! Thank you!