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.

Author
Message
Mugen Wizardry
User Banned
Posted: 26th Jul 2010 17:22
What is wrong with this loop code?

I can't get it when it's at a high enough angle, to detect that the player is too heavy and make the player turn around the opposite way he is facing, and run back down the loop.

but if his speed is > 0 and he's at the top of loop, then automatically fall off the loop.



CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 26th Jul 2010 17:49
You may need to rethink how you do the loop. The reason an object can go in a loop-de-loop is because the centrifugal force of that object is greater than that of gravity. You COULD simply symulate it, or you could use a formula:
F=M*A
When we are talking about an object going in a circle (or near circle), it's easy to calculate the force. Give your object a mass (let's make it 1.0lb). The acceleration is the inertia (or the speed of the object in the case of a loop). We will give it a value of 50.0ft/sec (because we are talking about going in a loop the value is going to come out to 50.0ft/sec^2) because an object going on a curved path is in constant acceleration with respect to it's vector.
F=1.0*50.0
F=50.0 foot-pounds-force
Now factor in the friction each frame so that the object is slowing down ever-so-slightly. Now factor in gravity, which will only effect the Y component of the object's vector.

Collision detection will probably mess up the physics, so you may want to completely get rid of it during the loop-de-loop part of your game.
On second thought, you may want to scrap the collision detection and the physics for this one. Determine the center of the loop-de-loop. Once the object enters the loop, simply rotate it around the loop and slow it down with a "friction" factor. You don't have to be exact, you just need to slow it down so that if at any point the object reaches the critical "fall off the track" speed, it will fall..... Just a few thoughts. If you want to go the physics route, I'll be happy to help you. I'll be happy to help anyway.

The fastest code is the code never written.
Mugen Wizardry
User Banned
Posted: 26th Jul 2010 17:50
this works better.

but still not working.



CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Mugen Wizardry
User Banned
Posted: 26th Jul 2010 18:02
getting there.

but still glitchy


CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Mugen Wizardry
User Banned
Posted: 26th Jul 2010 18:44
ok, hawkblood, i need ur help

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 26th Jul 2010 18:53
I'm not at my home pc now, but I will try to come up with some code here (you will have to check the syntax on some I'm sure). Give me a few and I'll try to have something for you.

The fastest code is the code never written.
Mugen Wizardry
User Banned
Posted: 26th Jul 2010 18:57
thanks alot, hawkblood!

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 26th Jul 2010 19:26
I'll use sparky's collisions for this:

set up your loop and your "truck?" with sparky's
(Disclaimer: Some of the functions may not be spelled correctly, so check them)

So, basically, your truck is moving along a non-descript track and out of nowhere a loop-de-loop appear in front of it. Once every frame the truck is pushed down by gravity and is repelled by the road/loop. As the truck goes more and more along the loop, it's angular momentum is changing direction (it's pitch). Each time it's pitch is changed, the movement direction changes with it. Gravity is still working, but because the truck is moving so fast, the force of it changing direction is countering it (if it's going fast enough). I'm very curious to see if it works.

The fastest code is the code never written.
Mugen Wizardry
User Banned
Posted: 26th Jul 2010 19:27
How would I implement this?

I'm interested to see if it works

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 26th Jul 2010 19:35 Edited at: 26th Jul 2010 19:38
Replace your Player() function with GoTruckGo() and take out everything in your do-loop except:

Make a few globals:
Falling# as float
TruckMesh=2
loopmesh=1
gravity is allways on... It's not just a good idea, it's the law!

I think that's it..... Make a copy of YOUR program before changing it.
EDIT: You need to declare Speed# as a global and that's your "make truck go faster" variable.

The fastest code is the code never written.
Mugen Wizardry
User Banned
Posted: 26th Jul 2010 19:55
Ok, for some reason my player is still
falling through the floor.

even with collision on.

i implemented ur code best i could



ignore anything with rem
any further fix would be appreciated

thanks, hawkblood!

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 26th Jul 2010 20:09 Edited at: 26th Jul 2010 20:12

This part concerns me. For simplicity, change it to something like this:

And take out the "set global collision on" statement. You are using Sparky's, don't mix and match DBP collision system with Sparky's. In fact, look thru your code and take out ANYTHING that uses DBP collision detection. Without being able to run the code myself, it's hard to tell where it's going wrong.

Try that stuff and see what we get.

EDIT:
Oh, yes, take out the move object TruckMesh,Speed# in the collision detection part:


The fastest code is the code never written.
Mugen Wizardry
User Banned
Posted: 26th Jul 2010 20:23
Ok, I'm just going to upload it for u.

It's not working right.
The attachment is on this post.

Thanks, hawkblood!

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 26th Jul 2010 20:28
I'll have to try it out at home..... I'm at my work pc now and we don't have DX installed on these machines. Post the code for now. What is it doing/not doing?

The fastest code is the code never written.
Mugen Wizardry
User Banned
Posted: 26th Jul 2010 20:38
Well, lemme reupload it.

ok

there

now it doesnt have collision on player to land at all..



CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 26th Jul 2010 20:48
OH, so the land and the road are not part of the loop?
ARRRG! change pitch object up TruckMesh,sc_getcollisionnormaly()-object angle x(TruckMesh)
to pitch object up TruckMesh,cos(sc_getcollisionnormaly())-object angle x(TruckMesh)
The truck will fall initially until it hits something that is governed by the collision engine. If the ground is a seperate object (I don't see it), then you need to include that in the collision testing--or-- if the ground is completely flat, you can have a "ground height" that the truck will NEVER go below:
if object position y(TruckMesh)<GroundHeight then position object TruckMesh,object position x(TruckMesh),GroundHeight,object position z(TruckMesh)

The fastest code is the code never written.
Mugen Wizardry
User Banned
Posted: 26th Jul 2010 20:55
still not working.



the floor is part of the loop

thanks as usual, hawkblood!

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 26th Jul 2010 21:09
You took out the wrong move object TruckMesh,Speed#....
Take out the one inside the "if Collide#" and put the other one back..... Here:

The new part might help....
I wish I could compile this and figure it out for you.

The fastest code is the code never written.
Mugen Wizardry
User Banned
Posted: 26th Jul 2010 21:21
still falling.



thanks, hawkblood!

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 26th Jul 2010 21:24
Copy and paste it again-- don't change anything.... You put some code in the wrong place and rem'd out other sections-- don't change anything....

The fastest code is the code never written.
Mugen Wizardry
User Banned
Posted: 26th Jul 2010 21:30
its STARTING to work.

it still does weird stuff when u touch the loop part of it anyway.

also, the player just kinda bounces back up off the floor


thanks, hawkblood!

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 26th Jul 2010 21:34
Play with move object TruckMesh,3.0 and move object TruckMesh,-3.0 .... Adjust them down/up but keep them opposites of each other.

Let me know.....

The fastest code is the code never written.
Mugen Wizardry
User Banned
Posted: 26th Jul 2010 21:38 Edited at: 26th Jul 2010 21:38
move object TruckMesh,-1.0 makes it flip around randomly on ground

move object TruckMesh,1.0 makes it do the same as above, however he flies upwards at a great pace.

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 26th Jul 2010 21:42
Remember, you have to change both of those statements:


The fastest code is the code never written.
Mugen Wizardry
User Banned
Posted: 26th Jul 2010 21:51
Yea, isnt working.



It's making it crazy :S

thanks, hawkblood!

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 26th Jul 2010 21:52
Did you try 1.0 and -1.0?

The fastest code is the code never written.
Mugen Wizardry
User Banned
Posted: 26th Jul 2010 21:54
yea, 1,-1 freaks
out

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 26th Jul 2010 21:55
I'll be home in about 1.5hrs . I'll check it out then-- It will be my first priority.

The fastest code is the code never written.
Mugen Wizardry
User Banned
Posted: 26th Jul 2010 22:02
ok, here's the upload.

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 26th Jul 2010 23:28
Send it using the built-in window's compression. I don't have winzip.

The fastest code is the code never written.
Mugen Wizardry
User Banned
Posted: 26th Jul 2010 23:45
here ya go!

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Mugen Wizardry
User Banned
Posted: 27th Jul 2010 00:05
did that help?

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 27th Jul 2010 05:19

My brain is about to explode!!! The math that governs the DBP universe is very tricky. I got it to go up and around the loop. It only goes in one direction and I'm not using gravity yet.... See if you can make it go both ways before you implement gravity.

The fastest code is the code never written.
Mugen Wizardry
User Banned
Posted: 27th Jul 2010 15:06 Edited at: 27th Jul 2010 15:09
Ok, so far, I think it works, but sometimes,
it goes through the wall..



thanks, hawkblood!

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 27th Jul 2010 15:22
Quote: "Ok, so far, I think it works, but sometimes,
it goes through the wall.."

When? What conditions? Fast?

The fastest code is the code never written.
Mugen Wizardry
User Banned
Posted: 27th Jul 2010 15:23
when the player rotates a certain direction
i think.

and i think when he goes too fast.

other than that he CAN go all the
way around the loop

thanks, hawkblood!

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Mugen Wizardry
User Banned
Posted: 27th Jul 2010 15:38
yea, confirmed, the above is
the problem

thanks, hawkblood!

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 27th Jul 2010 16:03
Currently the player can go only one way around the loop. Going the other way doesn't work. I'll have to come up with better code to account for higher speeds.

The bigest problem I ran into was the Z-axis rotation kept changing when there should have been none. DBP uses DX math and DX math is not the most accurate. When two axis' are being used the third feels lonely and wants to play too . If you want to make multiple loops in different directions, We'll have to do some serious matrix math. I suggest you stick with either one or multiple of the same orientation..... Of course you could have a seperate loop oriented 90degrees out which would require a change in our code (swaping the X and Z stuff). Just stick with the one for now.

As far as the speed problem,


I think I got everything covered.... Just replace the old function with this one (copy the old one just in case). This should account for any speed. It may be a little jerky, but it shouldn't go thru the wall now.

The fastest code is the code never written.
Mugen Wizardry
User Banned
Posted: 27th Jul 2010 16:17
ok, now that it works, how can we
make the player stay on the ground
and not go flying in different directions
if the player misses a wall?

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 27th Jul 2010 16:29
Add gravity. Make a copy of the code you have now while it still works!
......
......
Now let's try adding gravity to the equation.

Put that in and see what hapens. First try to stay on the loop all the way around, then do it so that you miss part of the loop and fall off. It still doesn't matter how fast you are going, If you are on the ramp you SHOULD stay on the ramp....???

The fastest code is the code never written.
Mugen Wizardry
User Banned
Posted: 27th Jul 2010 16:38
ok, now the player is bouncing
when on the ground, and when he moves and hits a straight wall of the loop, he climbs up that wall

also, when the player is
on the loop, and rotated differently,
and moves off the loop, he continues flying in that direction

thanks, hawkblood!

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Mugen Wizardry
User Banned
Posted: 27th Jul 2010 16:47
is that enough info?

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 27th Jul 2010 16:49
Ok. Let's deal with the bouncing first. I it bouncing on the ground when not even moving?

The fastest code is the code never written.
Mugen Wizardry
User Banned
Posted: 27th Jul 2010 16:51
yes

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Mugen Wizardry
User Banned
Posted: 27th Jul 2010 16:58
it also bounces on
the loop

causing the player to fly off the loop

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 27th Jul 2010 17:03
Try this one: (just replace)


The fastest code is the code never written.
Mugen Wizardry
User Banned
Posted: 27th Jul 2010 17:05 Edited at: 27th Jul 2010 17:06
nope.

still climbs up straight walls

still flys off loop
if player goes off the loop

DOES stop falling through the floor
but only up to a certain speed.

meaning u have to go FAST around the loop
before falling through the floor.

thanks, hawkblood!

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Mugen Wizardry
User Banned
Posted: 27th Jul 2010 17:07
o yea, and he still bounces
when not moving

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Mugen Wizardry
User Banned
Posted: 27th Jul 2010 17:13
is that enough info or do you need more?

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 27th Jul 2010 17:18
Wow. I posted a reply with updated code and the server didn't take it. Here it is again:


The fastest code is the code never written.

Login to post a reply

Server time is: 2026-07-25 14:24:55
Your offset time is: 2026-07-25 14:24:55