PDA

View Full Version : Unicycle



DrownLies
05-14-2014, 08:09 PM
Hey all!

I'm currently building a skillgame in which the bike is a unicycle.
http://s1.directupload.net/images/140514/temp/a2i6mmd3.jpg (http://www.directupload.net/file/d/3622/a2i6mmd3_jpg.htm)
But now I have problems with fixing it to the driving line. It rotates in every direction and I dont know how to fix it.
I tried to physically connect some dummyblocks to it and set "fix to driving line" in their properties to true but the connections just started to bug arround.
If it's not clear how it looks I will upload a video of it.
Thanks a lot,

Chilly

BMXBandit777
05-14-2014, 08:33 PM
Try attaching the wheel to a 2 axis slider with a physics joint (rotation) and ope everything else to the wheel. :)

Jolanphone
05-15-2014, 12:17 AM
Dummy objects are unreliable

DrownLies
05-15-2014, 02:05 PM
Try attaching the wheel to a 2 axis slider with a physics joint (rotation) and ope everything else to the wheel. :)
I tried that out but that happened:
https://www.youtube.com/watch?v=abWllmKRhk0&feature=youtu.be
it just buggs around although i set conection force to 50.

SparkierJoNESZ
05-15-2014, 02:32 PM
are you sure you limited the movement and rotation in the right ways?
connection strength should be enough at 2 or 1

BMXBandit777
05-15-2014, 03:02 PM
Just tried it and it doesn't work as I hoped - tried with slider and rotation joint on both sides, that worked a bit better but best results I've had so far is to use a sphere (variation 3) (turn phys on / lock to d/l / visability off/ phys type = contact response) then use an O.P.E. + vector object info source (object = ball) (OPE target =tyre[I used car wheel right)

You can then use controller inputs and set value events to add rotation to tyre via O.P.E. --- add a second O.P.E. using same xyz (position only) and link that to an area effector to move the sphere via same controller inputs.

Edit: just tried a few other tweaks and it works great - you can even add the unicycle body lean (forward/back) using another O.P.E. for the body with the same controller inputs and a couple more set value events + generic filters :)

DrownLies
05-15-2014, 03:42 PM
My brain hurts but I think I got it now.
You want to use a sphere instead of the wheel an aply the force to it.
Then just OPE the wheel with the informations from the sphere and physically attach the bodypart to the wheel.
First of all: thats genious but I see a problem.
The bodypart will not put any force on the sphere so the unicycle will not behave correct.
if the body goes to the right the wheel will not go to the left.
I hope you see the problem.

BMXBandit777
05-15-2014, 04:03 PM
No just start by OPEing the wheel to the xyz position co-ords (global) then using left n right controller inputs you can change the wheels rotation (local)

The body (separate) can then be OPE'd (global) to either the wheel or sphere - set it to no contact - and give it it's own set of rotational limits - say 45 degrees either way (local)

So as you push Right it does 3 things:

1. Sets force for area effector
2. Gives the wheel rotation
3. Make the body lean right 45degrees

Because the wheel and body are set to no contact they should have no effect on the sphere only the area effector has.

Hope this makes sense :)

DrownLies
05-15-2014, 04:17 PM
Yeah but I want it to be a skillgame and how challenging could it be to balance an oped boddy?

BMXBandit777
05-15-2014, 04:31 PM
Ahhh ok didn't realise that's what you were going for - thought it was gonna be a rolling down a track sort of game :)

JolanXBL
05-16-2014, 11:34 AM
From the video it looks like only the wheel was locked to the driving line but not the body. Add the same joints up there too.

DrownLies
05-16-2014, 03:25 PM
thats very frustrating. i now tried it hours and can't get it working

BMXBandit777
05-16-2014, 07:35 PM
OK mate I think I've figured it out - there is a way to have the wheel OPE as suggested before and have the 'body' attached with a rotation hinge. I have an example working but can't upload a video or pictures yet n I'm just about to go to work (nights) :( if your on x360 I can post the track so you can see it working but you won't see any of the mechanics - I'll try and do a Google.doc detailing everything for you tomorrow :)

DrownLies
05-16-2014, 09:23 PM
I just tried to OPE the tire to a sphere and physically connect the boddypart to the tire but the physicjoint bugs around when it is connected to an OPEd object =(

BMXBandit777
05-17-2014, 12:50 PM
Yeah you can't link it directly but you can do this - get 3 object info data sources (all position) set 1 to x, 1 to y and 1 to z, then get a two input operator(operation = add) and place it below the y position - set operand 1 value as the y position and operand 2 to 1. Then take another OPE (global) and set the x+z values to the o.i.d.s. and the y value to the two input operator then select a glue tool as the target. You will see the glue tool sits above the wheel but follows it around. Now you can attatch a rotation joint to that glue tool and the body peice you want to use [I added a glue tool to the body as this allows you to fine tune the bodys centre of mass].

The rotation hinge is set up like this:

Properties:advanced
Target 1: body
Target 2: glue tool
Angular settings : lower - 45 / upper 45 / softness 1 /damping 80 / restitution 1
Disable collision : on
Joint strength : 1

Rotate joint pivot 45degrees and place in the same place as the new glue tool. I had the bottom of the body piece level with the new glue tool and the body's glue tool at the top of the red circle that represents the hinge. Weight of body was set as low as possible / physics on / angular damping set to 95 / physics type - no contact( but this can be left on default )

Then I took 2 area effectors, each with there own glue tool ( but you could just use 1 for both )(use same OPE that is targeting the other area effector) 1 angled 45 degrees up-left and the other 45 degrees up-right ( so they both point at the body ). Go into force settings: affected objects: select object instances - target= body. Directional forces for each area effector get values from Variable Data Sources described below.

From the left / right controller inputs I had 7 set value events ( 3 each side + 1 for both )
On down:
1st pair : set the force to move the ball (left -1000 / right 1000)both target the same variable data source
2nd pair : set rotation for wheel ( left decrease 2 / right increase 2)both target the same variable data source
3rd pair : each of these (left : set 5 / right : set 5) targeted there own variable data sources - these are for the two 45degree area effectors

Left/right on release : set value event ( set 0 ) this targets the VDS's for 1st pair and 3rd pair. So only when you push the controller will the 3 area effectors be active.

I hope this helps you and you can make sense of it :)

DrownLies
05-18-2014, 12:21 AM
Sorry for answering that late, but I had no time today.
It's awesome how much work you put into this to help me buddy!
That's really nice off you. I will test this out when I wake up tomorrow ;-)

BMXBandit777
05-18-2014, 12:04 PM
No problem mate :) happy to help + I like a challenge in the editor :D

JolanXBL
05-19-2014, 11:58 AM
Y'know... if the driving line is straight... you could just put a Collision box on either side of it and set their Friction values to 0. :)

Like pulling a DVD off the shelf :P.

dasraizer
05-19-2014, 03:13 PM
hehe Jolan that by far has to be the easiest method, i was going to suggest adding dummys front and rear with joints that were locked to d/l but thats more work that true running rails.

SparkierJoNESZ
05-19-2014, 03:35 PM
if jolans method doesn't work well with your current unicycle glue an invisible object to it with collision detection(weight as small as posible)
beware that it shouldn't hit the ground ever though so you would need to take precautions

BMXBandit777
05-19-2014, 04:32 PM
Y'know... if the driving line is straight... you could just put a Collision box on either side of it and set their Friction values to 0. :)

Like pulling a DVD off the shelf :P.

Jeez jolan you could of suggested that a week ago lol :D

You know me, I never do things the easy way :)

DrownLies
05-19-2014, 08:12 PM
Y'know... if the driving line is straight... you could just put a Collision box on either side of it and set their Friction values to 0. :)

Like pulling a DVD off the shelf :P.

That's awesome XD and it works. can't belive it ='D
100 credits to you. the dvd is out XD

http://i.imgur.com/5ZvbYDb.jpg

This will be called the DVD technique.

DrownLies
05-19-2014, 08:57 PM
I have a further question: What's the best way to make a frozen physicall connection. I'am asking because the gluepoint of the bodypart and the wheel are at the exact same place. I think the physicall connection between those two things will work best this way. But now theres now whight to unstabilize the unicycle, so I want to attach an dummyobject to the bodypart.

Jolanphone
05-21-2014, 03:31 AM
I'm just simple-minded 'is all ;)

I think the center of gravity is the Glue point so raise that up to adjust the wonkiness. The wheel only needs the joint's pivot to spin correctly, so keep that aligned with the wheel.

If you must have the glue point down by the wheel however, you can attach a physical weight to the body using a Point-to-Point Joint.

I used one to keep the bike upright while driving off of the Line.

DrownLies
06-06-2014, 05:08 PM
Thanks to you guys I have nearly finished my project but there are to minor bugs left.
The first one: The wheel sometimes just blocks in a direction until you drie in the other dircection for a short distance.
Then it behaves normally again. On high speeds that could lead to a fail. (counter on 1:47 in the video below)
The second one: In my skillgame the wheel of the unicycle is able to turn faster as you last more time.
At a specific point it turns such fast, that the wheel starts to get in a starnge angle.


https://www.youtube.com/watch?v=a4eO0kiMlEA&feature=youtu.be

hope you can help,
Chilly

SparkierJoNESZ
06-06-2014, 06:49 PM
you tried increasing joint strenght by 1 or 2?

JolanXBL
06-08-2014, 09:06 AM
How about duplicating the joint so that there are 2 identical joints holding the wheel in place? It looks like it's spinning too fast for the joint to handle.

DrownLies
08-03-2014, 08:38 PM
After a long while I came back to the map and tried both tipps. Duplicating and movig the joints out of the middle seems to do the job. At least I didn't reached a spead where the bug happens. Thx a lot! =) The "wheel blockated bug" persists sadily.

The map is now playable on pc. Its name is "Pimp my hamster". Thank you very much for the help. Without it I wouldnt got it to work.