jump ramp

I have a motorbike looking shape that works fine until I hit a ramp.
The ramp is a curve like a quarter circle that points up so the
motorbike should point up the screen 90 deg from ground by the time it leaves this ramp. The ramp was crated with PhysicsEDitor.

The problem is I cant get the object to travel up the ramp and jump.
I have tried applyForce to death and I tried increasing motorspeed.

The object just hits the ramp and moves up a small way with the wheels spinning.
If I can get the object to travel along the curve surface then I could use applyforce when at the end of the ramp.Th object just wont overcome gravity. Box2D with Flash doesnt have this issue.

[lua] self.backwheel = display.newImage(“backwheel.png”)
physics.addBody( self.backwheel, {friction=1.0, bounce=0, density=0.1, radius=16});
self.backwheel.myName=“backwheel”
self.backwheel.x=x-10;
self.backwheel.y=y;
self.frontwheel = display.newImage(“frontwheel.png”)
physics.addBody( self.frontwheel, {friction=1.0, bounce=0, density=.1, radius=16});
self.frontwheel.myName=“frontwheel”
self.frontwheel.x=x+50;
self.frontwheel.y=y;
self.body = display.newImage(“body3.png”)
physics.addBody( self.body, {friction=1.0, bounce=0, density=.1});
self.body.myName=“body”
self.body.x=x+20;
self.body.y=y-20;
self.rear_weld = display.newImage(“weld.png”)
self.front_weld = display.newImage(“weld2.png”)
self.rear_weld.x=self.body.x -20; self.rear_weld.y=self.body.y +10;
self.front_weld.x=self.body.x +20; self.front_weld.y=self.body.y +10;
physics.addBody( self.rear_weld, {friction=1.0, bounce=0, density=.5});
physics.addBody( self.front_weld, {friction=1.0, bounce=0, density=.5});
self.rear_weld_joint = physics.newJoint(“weld”, self.rear_weld, self.body, self.rear_weld.x, self.rear_weld.y)
self.front_weld_joint = physics.newJoint(“weld”, self.body, self.front_weld, self.front_weld.x, self.front_weld.y)

self.myjoint = physics.newJoint(“pivot”,self.rear_weld, self.backwheel, self.backwheel.x,self.backwheel.y )
self.myjoint2 = physics.newJoint(“pivot”,self.front_weld, self.frontwheel, self.frontwheel.x,self.frontwheel.y )
self.wheel_distance_joint = physics.newJoint(“distance”,self.backwheel, self.frontwheel, self.backwheel.x, self.backwheel.y, self.frontwheel.x,self.frontwheel.y)

self.frontwheel:applyForce(2000,1000,self.frontwheel.x,self.frontwheel.y)
[/lua] [import]uid: 138547 topic_id: 26127 reply_id: 326127[/import]

What’s your gravity setting?

Have you tried running this in hybrid mode? [import]uid: 8271 topic_id: 26127 reply_id: 105903[/import]

I have tried a gravity setting of 10 and .1. if it is too low the motorbike wheels come off the ground on the flat to easily.

The problem is how can you get an object to tranverse inclines of 45 to 90 deg with pivot joints?

Flash can do this but they use wheel joints but I cant find a complete example of a working wheel joint in corona. [import]uid: 138547 topic_id: 26127 reply_id: 105983[/import]

A pivot joint isn’t the right choice for this. All of the details on the wheel joint (and every other joint) is detailed here…

http://developer.anscamobile.com/content/game-edition-physics-joints

Additionally, welding parts of the bike together might not be ideal. More joints means more potentially unpredictable behavior. A multi-part body for the “core” bike (minus wheels) would be much better. Instructions for that are contained on this page…

http://developer.anscamobile.com/content/game-edition-physics-bodies [import]uid: 9747 topic_id: 26127 reply_id: 106027[/import]

I suspected a wheeljoint is the best and a pivot joint isnt appropriate but this below didnt work at all. The bike literally falls apart. So what have I done wrong?

myJoint = physics.newJoint( “wheel”, wheel1, body, body.x,body.y, 20,20)

myJoint2 = physics.newJoint( “wheel”, wheel2, body, body.x,body.y, 20,20) [import]uid: 138547 topic_id: 26127 reply_id: 106061[/import]

This didnt work either.
I don think the wheel joint works in Corona

self.myjoint = physics.newJoint( “wheel”, self.backwheel, self.body, self.backwheel.x, self.backwheel.y, 0,20 )
self.myjoint2 = physics.newJoint(“wheel”, self.frontwheel,self.body, self.frontwheel.x, self.frontwheel.y, 0,20 )
[import]uid: 138547 topic_id: 26127 reply_id: 106225[/import]

I see the problem is I cant set the speed as it always prints 1 and nothing happens for a wheel joint

self.backwheel = display.newImage(“backwheel.png”)
physics.addBody( self.backwheel, {friction=1.0, bounce=0, density=1.0, radius=16});
self.backwheel.myName=“backwheel”
self.backwheel.x=x-10;
self.backwheel.y=y;
self.frontwheel = display.newImage(“frontwheel.png”)
physics.addBody( self.frontwheel, {friction=1.0, bounce=0, density=1.0, radius=16});
self.frontwheel.myName=“frontwheel”
self.frontwheel.x=x+50;
self.frontwheel.y=y;

self.myjoint = physics.newJoint( “wheel”,self.frontwheel, self.backwheel, self.frontwheel.x, self.frontwheel.y, 20,20 )

self.myjoint.isMotorEnabled=true;
self.myjoint.motorSpeed=500;
print (self.myjoint.motorSpeed); --prints 1

Now this example has a wheel joint and it seems to work but I have no idea how a wheel joint works.
http://www.youtube.com/watch?v=hpa48QGFKsU
[import]uid: 138547 topic_id: 26127 reply_id: 106354[/import]

I apologize: the wheel joint actually isn’t the correct joint for wheels on a car. There seems to be a fair amount of confusion about this; even the guy in the video you linked to said it doesn’t do what he thought it would. Some other users have created “cars” with wheels using pivot joints. I quickly assembled the following code, and it seems to work basically well… of course you’ll definitely need to tinker with the settings, values, etc.

[code]
local box = display.newRect( 200, 370, 240, 80 ) ; box.x, box.y = 160, 550
physics.addBody( box, “dynamic”, { density=1.0, bounce=0, filter=solidFilter } )

local wheel = display.newCircle( 200, 370, 50 ) ; wheel.x, wheel.y = 260, 580
physics.addBody( wheel, { friction=0.3, bounce=0, radius=50, filter=buildFilter } )
local myJoint = physics.newJoint( “pivot”, wheel, box, wheel.x, wheel.y )
myJoint.isMotorEnabled = true
myJoint.motorSpeed = -300
myJoint.maxMotorTorque = 100000

local wheel2 = display.newCircle( 200, 370, 50 ) ; wheel2.x, wheel2.y = 80, 580
physics.addBody( wheel2, { friction=0.3, bounce=0, radius=50, filter=buildFilter } )
local myJoint2 = physics.newJoint( “pivot”, wheel2, box, wheel2.x, wheel2.y )
myJoint2.isMotorEnabled = true
myJoint2.motorSpeed = -300
myJoint2.maxMotorTorque = 100000
[/code] [import]uid: 9747 topic_id: 26127 reply_id: 106364[/import]

Hi ,
Thanks for the reply
I already have this for my car. If I get rid of weld joiints I am back to where I started.
It works fine until I reach a steep incline through a circular surface until it points up and the wheel just spin.

I cant create a car which jumps off a ramp pointed 90deg.
[import]uid: 138547 topic_id: 26127 reply_id: 106377[/import]

Can you be more specific about a “circular surface”? Do you mean like a “half pipe”? And then, I assume this is contstructed from 6-10 bodies (or one body with 6-10 separate parts) to create a “curve”? If you can turn on “hybrid” mode in the physics simulator and then take a screenshot, that would be helpful…
[import]uid: 9747 topic_id: 26127 reply_id: 106429[/import]

Hi,

How do I add an image to my post here?
The ramp to jump is like a half pipe yes. I used PhysicsEditor on a single .png shape .

Anyway my 2 wheels and body shape (piot joints) just doesnt go very far up ths shape no matter how fast I go.

In Flash box2D they use a wheel joint to create a car and it does go up any surface. I cant do this in Corona. [import]uid: 138547 topic_id: 26127 reply_id: 106442[/import]

If you have a website and can upload the screenshot, you can just <img> tag it here. Otherwise, just e-mail me the screenshot (I assume you still have my address from our previous discussions). Be sure and set your physics view to “hybrid” so I can see the actual object that Box2D is seeing, not just the .png image you defined.

Thanks,
Brent
[import]uid: 9747 topic_id: 26127 reply_id: 106456[/import]

OK I emailed it to you.

Not sure how to get a ramp like a half pipe [import]uid: 138547 topic_id: 26127 reply_id: 106460[/import]

Jing is fee, posts to screencast quite easily and is pretty handy… [import]uid: 8271 topic_id: 26127 reply_id: 106487[/import]