Welcome Guest [Log In] [Register]
We hope you enjoy your visit.


You're currently viewing the Ultimate 3D Community as a guest. This means that you can only read posts, but can not create posts or topics by yourself. To be able to post you need to register. Then you can participate in the community active and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.

Join our community!

If you are already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
Deflecting off edges/railings...; Yea
Topic Started: Sep 18 2007, 07:13 AM (558 Views)
MrUlukai
Member Avatar
Devoloper of Karts.
[ *  *  * ]
So, im making this Go Kart Game,

Posted Image

cute aint it?
Anyway, I found out I'm pretty dumb because I cant figure out some good code for collisions with a railing. Cars usually dont move along the edge when they pretty much ram the right corner of the car into a rail. They deflect off, know what I mean. and not just straight rails either, more like curved, as you can see in the screenie.

Can someone give an example or maybe some code on how I can achieve more realistic physics. Not super physics or anything, but like a ball deflecting off a curved wall would be nice. Any input is great. Im having coders block or sumthin.

Thanks,
Brandon
* Click here to go to see Brandon Swift's Creations! *
Offline Profile Quote Post Goto Top
 
silverfire56
Forum God
[ *  *  *  *  *  * ]
yay another go-cart :lol:

but if you want a car example check Here

other then that, you will have to figure it out with MATH

or even look at the old u3d demo car http://u3d.xinto.net/OldDemoFull.zip
Offline Profile Quote Post Goto Top
 
MrUlukai
Member Avatar
Devoloper of Karts.
[ *  *  * ]
Looked at both, the car physics example doesnt really deal with collisions other than z, so that didnt offer much help. And the old demo uses sprites for collision detection and crap. Like if x+32 > other.x Move(BLAH,BLAH,BLAH). But mine is a straight model, Im tryna get raycastin and move to coincide with eachother.

Im in my first year of college taking precalc, and all were really doing is reviewin, so my mind is fluttered with parabalas and quadratic equations and all that other bs, and i cant concentrate.

Thanks :P
* Click here to go to see Brandon Swift's Creations! *
Offline Profile Quote Post Goto Top
 
detuhooja
Member Avatar
Advanced Killer
[ *  *  *  * ]
mee too MrUlukai i have same problem :D
but i have can add gravitation but not wall collision with sliding :mellow:
ext. i' am using demo's car physics
<->
Offline Profile Quote Post Goto Top
 
silverfire56
Forum God
[ *  *  *  *  *  * ]
ok.. im already doing too much but im making a Mario cart clone so ill upload a example
Offline Profile Quote Post Goto Top
 
skarik
Member Avatar
kitten eating scum
[ *  *  *  *  *  * ]
Sorry to butt in, but...
You can use the raytracing functions, get the normal of the wall you're going to smash into, and then use that normal thingy to get your direction to bounce to.


Quote:
 
Im in my first year of college taking precalc...

:huh:
Blog|EHS
Offline Profile Quote Post Goto Top
 
MrUlukai
Member Avatar
Devoloper of Karts.
[ *  *  * ]
Ahh i c, that would be exactly what I need. Can you give some type of example code? That would be wonderful. Oh and PreCalc is Pre-Calculus or Algebra & Trigonometry some people call it.
* Click here to go to see Brandon Swift's Creations! *
Offline Profile Quote Post Goto Top
 
skarik
Member Avatar
kitten eating scum
[ *  *  *  *  *  * ]
Quote:
 
Oh and PreCalc is Pre-Calculus or Algebra & Trigonometry some people call it.

Yeah, I know. I'm taking it as my second year of math in high school.

BTW, I think this may work. It works with my alignment function.
Code:
 
GetDistanceToWhateverIsNearest(blalba);

ray_normal = CreateDirectionVector(-1,0,0);
GetRayTracingNormal(ray_normal);
rotx = -GetVector(ray_normal,3)*90;
roty = point_direction(0,0,GetVector(ray_normal,1),GetVector(ray_normal,2))+90;
Blog|EHS
Offline Profile Quote Post Goto Top
 
MysteriXYZ
Member Avatar
Master Matrix Masher
[ *  *  *  *  *  * ]
skarik
Sep 22 2007, 05:20 AM
Code:
 
ray_normal = CreateDirectionVector(-1,0,0);
GetRayTracingNormal(ray_normal);

Instead of the above, you can just write:
Code:
 
ray_normal = GetRayTracingNormal(-1);

No need to complicate things ;).
U3D is like candy; after extensive consumption, it's Best to brush.
Offline Profile Quote Post Goto Top
 
MrUlukai
Member Avatar
Devoloper of Karts.
[ *  *  * ]
WTF? Child prodigy or something? Roflz... Where you live? But ya, thanks for that guys, Ill check it out.

Brandon.
* Click here to go to see Brandon Swift's Creations! *
Offline Profile Quote Post Goto Top
 
MrUlukai
Member Avatar
Devoloper of Karts.
[ *  *  * ]
Ok, It looks like it should work perfectly, but Im getting some weird Blank Message Pop up everytime a collision is made...? My Code is basically.

GetDistanceToModel(global.level,x,y,z-2,0,roty2);
ray_normal = GetRayTracingNormal(-1);

In a nutshell. And I guess Everytime I GetRayTracingNormal, It pops up.

?? any thoughts?

PS. Ive now got snowmans. :clapping:
* Click here to go to see Brandon Swift's Creations! *
Offline Profile Quote Post Goto Top
 
detuhooja
Member Avatar
Advanced Killer
[ *  *  *  * ]
ok write here,because i dont want make own topic for this.

can somebody help me make car physics.it need wall slide collision

please help i need it.i have game with story and all what need for it,only models and graphic need to do

if somebody help i will release maybe demo in sometime :sad:

edit:should i give what i have already?
its only demo's car physic and i cant set gravitation,collisin and car moving on model
in both :(


"""""""""""silverfire are you doing example yet?""""""""""""""""""""""""""""


CREDITS FOR HE WHO CAN HELP!
<->
Offline Profile Quote Post Goto Top
 
silverfire56
Forum God
[ *  *  *  *  *  * ]
detuhooja
Sep 23 2007, 10:09 PM

  """""""""""silverfire are you doing example yet?""""""""""""""""""""""""""""

there are a million people who manage their time better then i.
i have swamped myself with things too do
right now i can think of 8 things that i need to do (including the helicopter, i haven't forgotten)

and naturally having done work for a entire term i need a break.
but it is equal 2rd on my "to do"
just hang in there for a few days, i have Thursday and Friday off. :yahoo:
Offline Profile Quote Post Goto Top
 
detuhooja
Member Avatar
Advanced Killer
[ *  *  *  * ]
ok i just asked, because i have time for game making but its stybid to do something if it can't make.ext i would do models for my game but why do if i car didn't work and then game didn't work -_-
<->
Offline Profile Quote Post Goto Top
 
MysteriXYZ
Member Avatar
Master Matrix Masher
[ *  *  *  *  *  * ]
MrUlukai
Sep 23 2007, 08:33 AM
Im getting some weird Blank Message Pop up everytime a collision is made...? My Code is basically.

GetDistanceToModel(global.level,x,y,z-2,0,roty2);
ray_normal = GetRayTracingNormal(-1);

Did you make sure to release ray_normal at the end of your code? Like this:
Code:
 
ReleaseVector(ray_normal);

If you didn't, you will eventually create too many vectors and this leads to an error message (no idea why yours is blank, though).
Alternatively, you can initialize ray_normal once in the Create Event of the object that calls your code:
Code:
 
ray_normal=CreateVector(-1,0,0,0);

and then use it in your code like this:
Code:
 
GetRayTracingNormal(ray_normal);

Then you only need to release it in the Destroy Event of that object.

Hopefully this helps.
U3D is like candy; after extensive consumption, it's Best to brush.
Offline Profile Quote Post Goto Top
 
« Previous Topic · Questions about Ultimate 3D · Next Topic »
Add Reply