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.

DarkBASIC Professional Discussion / - DBPro Coding Challenges -

Author
Message
Ric
19
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 1st Mar 2005 03:22 Edited at: 1st Mar 2005 08:36
Well so far my physics is a bit of a failure. Having said that, if you can hit the cueball and avoid making contact with any other balls, it moves quite nicely! Here it is anyway ......


<edit> - code updated below ...


Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 1st Mar 2005 07:12 Edited at: 1st Mar 2005 07:35
here's a solution to the rotation. Take your velocity vector and it apply it to the X and Z axii.

xrotate ball Xvector
Zrotate ball Zvector


snooker physics by hamish mchaggis
http://www.dannywartnaby.co.uk/rgt/index.php?board=8;action=display;threadid=2053

"eureka" - Archimedes
Ric
19
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 1st Mar 2005 08:38 Edited at: 1st Mar 2005 11:19
OK - here goes again:



Seems to work okayish. Note four lines of code borrowed from H McHaggis (thanks for the link Phaelax.)

Still to perfect the rotation ......


RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 1st Mar 2005 08:51 Edited at: 1st Mar 2005 16:14
Okay, here's my wip on this (posting so I can load it easily from home ). I'm working on the physics from a transfer of energy perspective along each axis (x & z for now). This way I don't have to play around so much with the trig. So far, I got the cue ball to shoot and stick rather nicely to the rack of balls.



Edit: Seems to work. It is "transferring" the energy. Not entirely sure how correct the physics are - still working on them. I want to blend more velocities, but glancing a ball seems to work just fine. Also, just the basics. The balls spin, but spin does not affect the physics.

"Droids don't rip your arms off when they lose." -H. Solo

REALITY II
Ric
19
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 1st Mar 2005 09:08
Learning evaluation:

Just noticed everyone is using types. Never used them before, and it's only just now that it's dawned on me what they're for! The other thing I've learned from this excercise is programming entirely in functions - never done that before now, but I can see big advantages. Also, if I was starting again, I would probably work in seperate x and z directions as everyone else seems to have done.


Coding Fodder
20
Years of Service
User Offline
Joined: 25th Sep 2003
Location: Somewhere in my cerebralcortex
Posted: 1st Mar 2005 10:38
I like all the collaboration on this one. Chris/phaelax thanks for psoting the rotation workaround. I still would like to see true rotation to show spin... I am leaving for a week tomorrow morning though and won't be able to work on it in time.

Something really catchy that makes people stop and think about the meaning of life and say to themselves "My but thats clever"
Ric
19
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 1st Mar 2005 11:27
Yes, this one definitely needed a team approach! I've just tried to incorporate rotation based on the points mentioned above, but it's still not quite right - they move more like ice hockey pucks!

It would be good to see a solid engine completed, even if it does go past the deadline, and then perhaps future challenges could use the engine to do things like adding pockets, or a scoring system etc. (A super hard AI challenge could be on the cards, too - creating an opponent! )


RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 1st Mar 2005 11:30
You may be on to something Ric. A set of challenges with an end goal in mind resulting in a complete collaboration project. Hmmmm....

"Droids don't rip your arms off when they lose." -H. Solo

REALITY II
Coding Fodder
20
Years of Service
User Offline
Joined: 25th Sep 2003
Location: Somewhere in my cerebralcortex
Posted: 1st Mar 2005 11:40
Hmm. If this thing is going to gain its own life. I would preffer that the collision be timer based and use prediction rather than checking to see if the balls are inside each other. That is how I am going to write it anyway

Something really catchy that makes people stop and think about the meaning of life and say to themselves "My but thats clever"
KimoSabi
19
Years of Service
User Offline
Joined: 18th Jan 2005
Location:
Posted: 1st Mar 2005 22:15
yes i think this post should kinda turn into a team (although im not helping much cause im not good with the physics stuff i good at AI (so i could help there )) you guys wannna be a team and make a fully functional pool game?(it is usually the same ppl here so it wont be to confusing

Hope ya agree,
Kimo Sabi

I must say I am quite a »»ç¶´¬¬Géñíú§¬¬´¶««
Ric
19
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 2nd Mar 2005 01:40 Edited at: 2nd Mar 2005 01:53
Uhoh - what have I started! I was just suggesting the possibility of using the code for future challenges - I wasn't making a team request! We need to make sure these challenges are accessable to newcomers too, so we shouldn't get too heavily involved in any one particular theme here - any spin off community projects, for example, need to be discussed in a different forum!


Anyway, almost time for a new challenge, Phaelax ........


KimoSabi
19
Years of Service
User Offline
Joined: 18th Jan 2005
Location:
Posted: 2nd Mar 2005 01:53
here i will start a new community post for this (yes i agree stick to this subject post)

I must say I am quite a »»ç¶´¬¬Géñíú§¬¬´¶««
TEH_CODERER
20
Years of Service
User Offline
Joined: 12th Nov 2003
Location: Right behind you!
Posted: 2nd Mar 2005 03:27
Ric's rules!

[url]andrewneale2004@yahoo.com[/url]
http://www.elbsoftware.tk
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 2nd Mar 2005 03:45
Ummm, how the heck do i judge this one?

"eureka" - Archimedes
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 2nd Mar 2005 05:10 Edited at: 2nd Mar 2005 07:59
Maybe late, but I think I like the physics a little better. Also added a cue stick. Move left/right with arrow keys. Left Mouse Click to build up power (energy). Release Left Mouse button to shoot. Haven't tried at very high Energy levels (>20).



"Droids don't rip your arms off when they lose." -H. Solo

REALITY II
Ric
19
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 2nd Mar 2005 06:57
Rii: The sync rate is set to 200, but my pc can only manage 140 fps - so the balls are a bit like lead weights at the moment. I've tried changing the values a bit, but I can't get a good compromise between balls acting naturally when they are bunched together and when they are seperated - ie seperated they go flying, racked up it's like they're glued together.

Also, there is a next c missing at the end of the move balls function.

Anyway, it'll be interesting looking at the physics to see how you tackled it.

@ Phaelax - looks like you're going to have to chose between Rii, CF and me unless Chris gets in a last minute entry.


Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 2nd Mar 2005 07:09
I'll declare CF as the winner, followed by Ric. r2d2, I smacked that pile of balls several times and they hardly moved if at all. Ric, your camera could use a little work. Didn't hold it against ya cause that wasn't the challenge. And CF, how about some Human control, eh?

For the new challenge, though another physics problem, should be easier from my own experience. Come up with a creative way to show off spring physics.


Challenge: To creatively use springs

"eureka" - Archimedes
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 2nd Mar 2005 08:00
Arrggh. I copied a wip. The Step# and For-c-loop was supposed to be removed. Thanks for trying it out though. I updated the code.

"Droids don't rip your arms off when they lose." -H. Solo

REALITY II
Ric
19
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 2nd Mar 2005 08:21
Rii: - that's working better.

OK - theoretically, the winner should be the next challenge setter, then the runner up if the winner isn't available, but as Phaelax's challenge is a good one, I'm happy to go along with that. Will you be around to judge this one Phaelax, and what's the time limit?


Ric
19
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 2nd Mar 2005 08:26 Edited at: 2nd Mar 2005 08:42
CHALLENGE 6

Challenge: To use spring physics creatively

Time limit: 4 Days (until Saturday night, 5/3/05)

Challenge setter: Phaelax

___________________________________________________________________

Phaelax to judge, Ric as reserve judge.


Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 2nd Mar 2005 08:37 Edited at: 2nd Mar 2005 09:30
oops, hehe i forget you set the challenge. Let's give it until saturday. I can't promise I'll be around though. I'm moving the rest of my stuff on saturday to my new apartment. With the snow storm, it's been hard moving this week. Computer is last thing to go, so I'll check friday night just to see how things are going.


ah crap, I already boxed my "physics for game developers" book and took it to the new place.

"eureka" - Archimedes
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 2nd Mar 2005 09:36 Edited at: 2nd Mar 2005 09:39
I need to get me one of those books!

@ Ric: Very good work! Excelent graphics as always! And I like the camera work (takes some getting used to).

(Sorry - haven't had much time to look these through yet)

"Droids don't rip your arms off when they lose." -H. Solo

REALITY II
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 2nd Mar 2005 12:16 Edited at: 2nd Mar 2005 19:25
just a basic example.

updated example to draw an actual spring.


"eureka" - Archimedes
Chris64
19
Years of Service
User Offline
Joined: 16th Oct 2004
Location: San Diego
Posted: 2nd Mar 2005 14:29
Well...the pool challenge was a good one. Everytime I reopened the source...my mind would start whirling around trying to nail the last details. By the time I got the balls reacting (and rolling) good my mind was so fried I couldn't think of how to handle the Camera...

OK...this spring thing sounds refreshing. Can anyone elaborate what Spring physics refers to?
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 2nd Mar 2005 19:07 Edited at: 2nd Mar 2005 19:09
It's just what it sounds like, springs.

F = -Kx

F = spring force
K = spring coefficient (0 to 1)
x = current position minus resting position of spring

Still need a small friction force, or the spring will move forever. Stretch the spring outward, and it'll snap back very fast. Push it inward, and it'll push its way back out. Connect multiple springs together to create neat things. The showcase demos my cloth sim using springs. Can't really take total credit on that, the code came from my physics book. I merely adapted it to DBP with slight changes. You could also make jelly. It's neat watching that bounce around.

"eureka" - Archimedes
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 3rd Mar 2005 02:14
Okay, slight mod to Phaelax's code to test my understanding of this. I think I have the principle down. Now onto bigger things. Thank Phaelax! Great learning experience here!



"Droids don't rip your arms off when they lose." -H. Solo

REALITY II
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 3rd Mar 2005 02:29
@ Ric (and anyone else). The physics weren't completed on the pool code. I was going to try and do the physics by transferring the energy from one ball to the next: 2 things I wanted to accomplish (eventually).
1) Break the movement down to smaller increments w/out a sync to increase the accuracy (granularity) of the physics and base that on a max Frame Rate so a higher framerate pc could use it's extra processing power to improve the accuracy of the physics. That's why the "For C" loop was in there, but I was removing it for lack of time.
2) Calculate the distribution of energy across a chain, or mass, of 'touching' pool balls before the next move. I hadn't figured out how to do this without compounding the energy each check (i.e. adding the 'same energy' to a ball more than once).

I also wasn't able to finish adding in the percent distribution of energy based on the angle of impact.

"Droids don't rip your arms off when they lose." -H. Solo

REALITY II
KimoSabi
19
Years of Service
User Offline
Joined: 18th Jan 2005
Location:
Posted: 3rd Mar 2005 02:42 Edited at: 3rd Mar 2005 02:43
my community pool post was a failure lol but that is ok

yes i must say this codding challenge idea (that i came up with lol) was quite a good idea it's a very good source to teach others for lots of good physics stuff(btw i'll enter my spring challenge entry tonight <<im at school >>

Thx Everyone,
Kimo Sabi

I must say I am quite a »»ç¶´¬¬Géñíú§¬¬´¶««
Coding Fodder
20
Years of Service
User Offline
Joined: 25th Sep 2003
Location: Somewhere in my cerebralcortex
Posted: 3rd Mar 2005 04:38
Riidii. I appreciate the problems you are tackling with the pool physics. I am going to tackle them myself when I get back to my beautiful computer a couple weeks from now.

I am going to do it a bit differently though.

I don't think smaller movements is the answer. I am simply going to calculate the equation of motion for each ball and parametrize with respect to time. Then I will solve each combination of equations. for each pair of balls and find the time of intersection. Then I will sort the times to find the smallest value and then use timer based movement till I reach that time. then I will recalculate everything. That way I should only have to do new calculations once every 100 loops or so on average. If the balls are all touching it will just keep recalculating till they seperate. But no time will really have passed (in the computer's world) so it should all work out precisely as true physics. I am going to ry it with streight line trajectories at first then see if I can add rotation to the equation of motion.

I don't know how well I explained that. I have trouble getting Ideas from one side of my skull to the other.

Something really catchy that makes people stop and think about the meaning of life and say to themselves "My but thats clever"
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 3rd Mar 2005 05:19
Actually, CF, that's almost identically where I ended up heading this morning. It occured to me that the bit-physics for each ball were too consuming and not always needed. So, if I think you are saying what I was thinking (huh?), then; unless two balls are colliding, then you don't bother to calc the bit-physics. But if they are colliding, you do the bit-physics until they aren't. Then they have their new directions and energy.

I still haven't figured out how to get around the chain-collisions and group-collisions problem. How to pass energy from ball 1 to ball n before moving any of the balls. Also, dividing up the energy appropriately, say when 1 ball collides with 2 balls, the energy should be dispersed between all 3. I was kind of hoping that using the bit-physics would solve most of this, but I'm not sure it would.

"Droids don't rip your arms off when they lose." -H. Solo

REALITY II
Hamish McHaggis
21
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 3rd Mar 2005 05:52
RiiDii - Just calculate the collision between two balls, hopefully your simulation will be fast enough to handle group collisions.

Codebase Entry - http://developer.thegamecreators.com/?m=codebase_view&i=d001861d9df91f6096e167b60daf8cb5

Isn't it? Wasn't it? Marvellous!
Coding Fodder
20
Years of Service
User Offline
Joined: 25th Sep 2003
Location: Somewhere in my cerebralcortex
Posted: 3rd Mar 2005 05:52
Riidii Are you still planning to check for collisions using the
1. move balls
2. check to see if balls are inside one another
3. do collision math

Or
1. calculate pxn(t) and pzn(t) for each ball n
2. calculate t for which px1(t)-px2(t)=0 and pz1(t)-px2(t)=0
3. sort times
4. move
5. collide repeat

If you use the second scheme the multiple ball collisions will work them selves out

Case:

two balls A and B smack into a third C simultaneaously from opposite directions ball C is at rest

The code will identify two collisions that share the same time t.
simply due to program ordering one will be calculated first. The collision routine will set the vel of ball A to 0 and set the vel of ball C to the initial vel of ball A.

Because there was a collision the program must recalculate all collision times. Remember no balls have moved as of yet just their velocities have changed. Because ball B is still contacting ball C the next collision time will be.. well.. right now the same value t as the collision between A and C. The program will chose to evaluate th B,C collision over A,C (which is still in contact) because the velocities of A and C indicate that the were just leaving each other. Balls B and C swap velocities.

Agian before we move anywhere the program is agian forced to recalculate the next collision time. Agian it is the same value of t because all three balls are still contacting. Now B and C have velocities in opposite directions so the computer ignores them and evlauates A,C. C comes to a rest and A takes on the velocity C had, which is inturn the velocity that B had a few calculations ago.

The computer evaluates agian. This time every one is moving away from everyone else and some other collision takes precedence some time t down the road. so we loop happily until that time is reached, Simply placing the balls at the value give by the equations pxn(timer()) and pzn(timer()).

END CASE

Sure the calculations will be fairly slow but it only has to happen once in a while and the timer() based movedment will hide it flawlessly.

Of course my explination is over simplified because I did not take into account the radius of the ball. But, I am sure that it can be done.

Something really catchy that makes people stop and think about the meaning of life and say to themselves "My but thats clever"
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 3rd Mar 2005 06:41
@Hamish: That's what I was hoping for. I think in the grand scheme of things, the accuracy would be more than sufficient.

@CF: That's along the lines of what I was thinking this morning. Evaluate all the collisions, pass all the velocities, then move. The problem I had was I came up with a day late . I'm now wondering on this newest challenge if that's something that could be applied to pool? Basically, the balls are really rebounding the the other balls like inverted springs (think +K# * d#) with a very high (or is it low?) K# value and a very high mass (aka. resistance to movement?) value. Do pool balls act like basket balls when they "bounce"?

"Droids don't rip your arms off when they lose." -H. Solo

REALITY II
Ric
19
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 3rd Mar 2005 07:58
Wow this really is going into depth! In terms of using predictive collision rather than real time collision checking, I can see the sense of it in terms of improving computation speed, but for a pool table with 16 balls on it, when you've already got a pretty decent fps, I'm not convinced it's worth the effort. If on the other hand you were trying to simulate much larger particle systems, more like what you might use for scientific research, then I'd see it as essential.

As for using spring physics for collision, that really would be overkill. Yes, you could, but if you really wanted to simulate the physics as realistically as possible, you could end up doing force calculations on every atom in every ball. But the whole point of 'modelling' a physical process, is that you make assumptions that enable you to produce a realistic outcome in the neatest possible way. For example, if you apply gravity to a character in FPS game, you wouldn't bother calculating the size and direction of the gravity first, as you might do in a planetary simulation - you'd just make the assumption that it is downwards towards the ground.


For my spring physics entry - I was thinking of trying to create a fluid flow simulation, using springs to calculate the surface tension - i.e. the force between vertices of a 3d object. Problem is, I've got to learn about vertex manipulation first - anyone know of any tutorials on this?


RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 3rd Mar 2005 08:24
Hey - Ric's onto something! Calculate the impact of every atom with global circular gravity! Let's give a shot.



I'll say these coding challenges are fun!

For my spring simulation I was thinking along the same lines as Ric, a drop of water or something. I was going to use a ton of small objects instead of learning to manipulate verticies, but I suppose it's something I'll need to do eventually.

"Droids don't rip your arms off when they lose." -H. Solo

REALITY II
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 3rd Mar 2005 08:38
Quote: "I've got to learn about vertex manipulation first - anyone know of any tutorials on this?"


Using only DBP commands, it would be too slow through memblocks. I vote on the the use of Dmitry's DLL. Lets you manipulate a model's data internally in real-time.
http://forum.thegamecreators.com/?m=forum_view&t=39906&b=5

"eureka" - Archimedes
KimoSabi
19
Years of Service
User Offline
Joined: 18th Jan 2005
Location:
Posted: 3rd Mar 2005 09:20
you guys should rly post your pool stuff on the forum i made for it lol

I must say I am quite a »»ç¶´¬¬Géñíú§¬¬´¶««
Ric
19
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 3rd Mar 2005 09:38
I'd rather keep plugins and wrappers out of these challenges - it makes them less accessable if people can't just paste the code snippet and run it.

As with all the raw code here, people can always add media, convert to work with plugins, etc. if that's what they want to use it for.

By the way - I added Azreal's motion blur effect to the pool code when you strike the cue ball - quite cool looking!:




KimoSabi
19
Years of Service
User Offline
Joined: 18th Jan 2005
Location:
Posted: 3rd Mar 2005 10:42
@Ric i dont rly want to be mean or anything but please post on pool post :/ but i do agree with for this forum about the plugins etc.
but for the pool game we can use media cause it is a community project

I must say I am quite a »»ç¶´¬¬Géñíú§¬¬´¶««
Ric
19
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 3rd Mar 2005 10:57
Sorry Kimo! How are your springs coming along? Be nice to see you enter something into this one!


Coding Fodder
20
Years of Service
User Offline
Joined: 25th Sep 2003
Location: Somewhere in my cerebralcortex
Posted: 3rd Mar 2005 12:27 Edited at: 3rd Mar 2005 12:31
hey ric. Check out my post for the weather challenge. The terrain that I made is my own object that I manipulate the vertex data of. There is a pile of functions in there that I wrote to change vertex data of objects. have fun..

[edit] And yes they are pretty fast. I did a little water thing with them myself a few mo ago and I got 400 fps changing xyz locations normal and uv coordinates of 600 vertices every loop.

Something really catchy that makes people stop and think about the meaning of life and say to themselves "My but thats clever"
Chris64
19
Years of Service
User Offline
Joined: 16th Oct 2004
Location: San Diego
Posted: 3rd Mar 2005 13:35
OK...this has nothing to do with anything...but it is something I wrote thanks to our little projects. Thanks to Phaelax for point out the Set Object Pivot command. I will actually use this instead of EZrotate for everything but Camera's. Maybe someone can look at it and suggest something.

Anyway, Here's a potential solution to solve Euler rotation problems. It's a simple function to rotate an object on a global axis. The only catch is that the Z axis needs to be sent as a Difference...it was either that or require a gloabl variable and since you may want several of these functions, this was the better alternative.

Tell me what you think.

Coding Fodder
20
Years of Service
User Offline
Joined: 25th Sep 2003
Location: Somewhere in my cerebralcortex
Posted: 3rd Mar 2005 23:08
Chris I can't wait to try it! but it looks like I have to. Like the name of your function

Something really catchy that makes people stop and think about the meaning of life and say to themselves "My but thats clever"
KimoSabi
19
Years of Service
User Offline
Joined: 18th Jan 2005
Location:
Posted: 4th Mar 2005 01:03
yes Ric i am working on springs but im having trouble and im busy trying to make a CD im trying to convince rick to help sell it (it is going to be like top 50 addicting games or something) but im hoping for the best i'll try to get that springs done tonight *sigh* <<also my parents are starting to worry about me being on the computer constantly which really sucks cause i know this is what i want to do with my life *sigh again* lol>>

I must say I am quite a »»ç¶´¬¬Géñíú§¬¬´¶««
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 4th Mar 2005 01:15
I'm understanding most of this spring formula (after all, it's not all that complicated), but I'm having trouble wrapping my brain around how change the springiness (K#?) when the objects are too close or too far. For example, if I take a spring and try to squish it down, I can't squish into negative space, I can only squish it until the coils are (eventually) touching.

Question: Is this a simple limit setting (i.e. If x#<2 then x#=2) or is there some type of exponential function that would keep the spring from inverting?

I can already grasp that I would have to apply the Force# value to my puller (usually the mouse), but beyond this... maybe I'm overworking the problem again? Help?

"Droids don't rip your arms off when they lose." -H. Solo

REALITY II
Ric
19
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 4th Mar 2005 02:00 Edited at: 4th Mar 2005 02:08
Quote: "Is this a simple limit setting (i.e. If x#<2 then x#=2)"


For springs, yes. The force on a normal spring will always be proportional to the extension or the compression - so no exponentional functions needed - the maximum compression when the coils touch will be just like if you had a maximum extension due to some object getting in the way - it just puts a cap on the extension.

<edit> Having said that - if you're simulating intermolecular forces as with surface tension, then spring theory is a bit of an approximation, and there are actually exponential forces involved. In a simulation of fluid, though, you will probably get pretty good results just using spring theory.

@ Chris - looks interesting - I'll give it a try.

@Kimo - tuh, parents...... mind you, I do a fair amount of my coding on paper. You don't have to be at the PC for everything.


KimoSabi
19
Years of Service
User Offline
Joined: 18th Jan 2005
Location:
Posted: 4th Mar 2005 02:53
yes i know i do alot of my coding on paper to but than i end up forgetting some command or (because of sloppy writing lol) i cant read my writing and i have to test a bunch of times to get it right but yes i know actually im at school right now writing some spring stuff

I must say I am quite a »»ç¶´¬¬Géñíú§¬¬´¶««
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 4th Mar 2005 07:10
I was beginning to worry that noone was doing the springs. To control the amount of springyness, adjust the coefficient and the mass. The mass alone can get quite different effects.
One idea I had was showing a simulation of a car's independent wheel suspension. Unfortunately, the graphics wouldn't be very accurate as there is no 3D spring primitive.

"eureka" - Archimedes
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 4th Mar 2005 08:22 Edited at: 4th Mar 2005 10:59
Here's a start for you Phaelax. Can't work on it too much at work. Please finish it (I think my limb angles are screwy).



Edit: Fixed!

"Droids don't rip your arms off when they lose." -H. Solo

REALITY II
Ric
19
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 4th Mar 2005 08:36 Edited at: 4th Mar 2005 08:39
And hence a future challenge is spawned.

<edit> - Ooh - 300th post!


Login to post a reply

Server time is: 2024-04-23 15:51:09
Your offset time is: 2024-04-23 15:51:09