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.

Work in Progress / Intelligent Ragdolls

Author
Message
robo cat
20
Years of Service
User Offline
Joined: 23rd Feb 2004
Location: In a cat litter tray, near you...
Posted: 11th Jun 2005 22:45
You may know from my other thread that I've been working on a Spore like system where ragdoll creatures work out how to walk. I've decided to put up a small 2 dimensional demo. In the demo press space to spawn a new body (up to a maximum of 50). The ragdoll bodies don't have angular restrictions on their knees etc as they can't turn round in 2D so wouldn't be able to walk in both directions. The engine does already support angular restrictions on joints though. The ragdoll bodies try to get their head to touch their fly which is randomly flying about. Gravity is low at the moment so they tend to hover a bit while climbing on the ceiling. There are 2 main bugs at the moment:
- ragdoll limbs can slice through the corners of collision boxes
- the bodies can support themselves with only one foot touching the wall

Both these will be fixed when it is converted to 3D - which should be quite easy.

Please bear in mind this isn't finished and values and the logic will be tweaked and improved, but I think it still looks quite cool.

Enjoy!

Simple... yet fun!
robo cat
20
Years of Service
User Offline
Joined: 23rd Feb 2004
Location: In a cat litter tray, near you...
Posted: 11th Jun 2005 22:47 Edited at: 15th Jun 2005 01:48
Forgot to attach the file, rather stupidly. So here it is.

<DOWNLOAD NO LONGER MOST RECENT VERSION - CHECK LATER POSTS>

Simple... yet fun!

Attachments

Login to view attachments
Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 11th Jun 2005 23:03
Wow thats pretty impressive dude, its fun to watch.. a 3D version would make a nice screensaver I reckon


"Lets migrate like bricks" - Me
Tom Taylor
20
Years of Service
User Offline
Joined: 29th Dec 2003
Location: Germany
Posted: 11th Jun 2005 23:06 Edited at: 11th Jun 2005 23:08
Hehe, cool and funny animation They do some "wall climb" and "stage dive" which is REALLY funny to watch.

What kind of "ragdoll creatures" are you using? Did you implement you own regdoll system?

EDIT: What are the bubbles for? This could be a "life simulation" system, where things get new arms/legs to walk and they find the way to some food to mutate again and again... )

Tom Taylor
hmm
21
Years of Service
User Offline
Joined: 11th Oct 2003
Location:
Posted: 11th Jun 2005 23:07
thats really cool...and quite scary and disturbing

they move in some kind of spidery/crazy zombie way, freaks me out.

I wanted to try something like this in newton but never really got into ragdolls.

Baggers
20
Years of Service
User Offline
Joined: 31st May 2004
Location: Yonder over dem dere hills
Posted: 11th Jun 2005 23:30
Yeah the 3d version would make awesome zombies.
Very nice demo man. Looking foreward to more.

Robot
20
Years of Service
User Offline
Joined: 27th May 2004
Location:
Posted: 11th Jun 2005 23:44
Thats amazingly well done. Well done indeed. Can't wait to see the 3D version.

The happenings of tommorow are behind us now
Flashing Blade
22
Years of Service
User Offline
Joined: 19th Oct 2002
Location: United Kingdom
Posted: 12th Jun 2005 00:20
thats very good

3D screensaver with spiders would be very cool.


The word "Gullible" cannot be found in any English Dictionary.
Psycho Gary
20
Years of Service
User Offline
Joined: 17th Sep 2004
Location: The United Kingdom....is boring
Posted: 12th Jun 2005 00:32
pretty nice... can you make it so the fps is a set value please? cause its running at 250fps and just lightly tapping the spacebar makes 14 bodies appear.... which zoom about the screen

(i loved it when i body climbed to the top, hanged for a second, and just went stiff and fell, mwahaha)

:p
TEH_CODERER
21
Years of Service
User Offline
Joined: 12th Nov 2003
Location: Right behind you!
Posted: 12th Jun 2005 01:02
Absolutely amazing! I agree with Psycho Gary about being able to add just one at a time. I guess he left it so we could see how fast it runs.

[url]andrewneale2004@yahoo.com[/url]
http://www.elbsoftware.tk
Kohaku
20
Years of Service
User Offline
Joined: 3rd May 2004
Location: The not very United Kingdom
Posted: 12th Jun 2005 01:43
That's very impressive. And equally freaky.

You are not alone.
Math89
20
Years of Service
User Offline
Joined: 23rd Jan 2004
Location: UK
Posted: 12th Jun 2005 01:58
Wow ! That's great !
David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 12th Jun 2005 02:04
Absolutely fantastic. Very organic - I loved watching a guy try and climb up onto the top of a block, only to fall off

Although it adds loads of bodies at once when you press space - perhaps limiting you to only adding a body every 250ms would solve it?

"A book. If u know something why cant u make a kool game or prog.
come on now. A book. I hate books. book is stupid. I know that I need codes but I dont know the codes"
Drew Cameron
20
Years of Service
User Offline
Joined: 30th Jan 2004
Location: Scotland
Posted: 12th Jun 2005 02:56
Very, very nice - they remind me of Daddy Long Legs - spiders.

Good work, my mind boggles as to how you did this

Dumbo and Cool

WIP Board!
robo cat
20
Years of Service
User Offline
Joined: 23rd Feb 2004
Location: In a cat litter tray, near you...
Posted: 12th Jun 2005 07:22
Wow, thanks for all the replies!

Quote: "Did you implement you own regdoll system?"


Yes, its my own ragdoll system written specifically for this. Its also got angular restrictions on the joints, but they're left out at the moment as they can't turn around the y axis in 2D so would get stuck moving backwards. The ragdoll system is specifically designed for this. I had a look at Newton but wanted to retain full control over the ragdolls, so I wrote my own from scratch.

Quote: "250fps"


Think the sync rate was locked to about that point. Didn't realise it would actually get into the 200s. It was reaching about 130 on mine so it wasn't too fast with about 10 creatures.

Quote: "What are the bubbles for?"


They are just randomly moving targets which the creatures try to hit with their heads. I did have them all chasing the mouse but it meant all the creatures went towards the same target, which looked a bit less interesting.

Quote: "Although it adds loads of bodies at once when you press space - perhaps limiting you to only adding a body every 250ms would solve it?"


I'll put a restriction on how quickly it spawns bodies in the next version. At the moment it was left to show the speed of the engine, I'll put a lower sync rate (about 50) in the next version and put a delay on spawning bodies.

Quote: "Good work, my mind boggles as to how you did this"


The actual code is reasonably simple and efficient. The complicated part was actually designing the way it can work out how to walk.

Quote: "they remind me of Daddy Long Legs"


I noticed that as well. It can, however, generate ANY anatomy. It isn't based on a conventional limb system and the creature's joints and limbs are all seperate entities. This means I can have any creature, with limbs joining round in a circle. I can also add and remove limbs/joints on the fly and it won't get confused. They look like daddy long legs at the moment mainly because of that the joints have no angular restrictions turned on, even though I could if I wanted, since they can't turn round in the y_axis so would end up walking backwards for most of it.

Quote: "Can't wait to see the 3D version."


Most of the code will not have to be changed much to work in 3D and was written as 3D and then trimmed to 2D. The only difficulty with 3D is getting the zyx angles between 2 points (already knowing the y angle). I should be able to sort this out with simultaneous equations of some sort. The actual AI logic will work as it is already, just with an extra dimension added to it.

Thanks for the replies!

Simple... yet fun!
Baggers
20
Years of Service
User Offline
Joined: 31st May 2004
Location: Yonder over dem dere hills
Posted: 12th Jun 2005 08:15
Quote: "The only difficulty with 3D is getting the zyx angles between 2 points (already knowing the y angle)."

Not sure how proficient you are with vectors but if you sketch out what you mean i may have a function to get the angle in 3D.

robo cat
20
Years of Service
User Offline
Joined: 23rd Feb 2004
Location: In a cat litter tray, near you...
Posted: 12th Jun 2005 08:20
Like the function atanfull() but instead finding both the x and z angles when only the x,y and z distances and also the y angle are known. The order of rotation I use is zyx. If you do have a function already for this, then it'll be greatly appreciated. Otherwise I'm sure I'll be able to solve it eventually.

Simple... yet fun!
Baggers
20
Years of Service
User Offline
Joined: 31st May 2004
Location: Yonder over dem dere hills
Posted: 12th Jun 2005 09:09
Ooo...tricky...nope i dont have a function for that...but I'll think about it, definately a challege ! youll probably beat me to the answer though.

robo cat
20
Years of Service
User Offline
Joined: 23rd Feb 2004
Location: In a cat litter tray, near you...
Posted: 12th Jun 2005 18:42 Edited at: 15th Jun 2005 01:48
Quote: "definately a challege"


Think I'll solve it by extracting simultaneous equations from a rotation matrix.

Attached a new version. Its pretty much identical, the only changes are the sync rate is locked to 60, the creatures have shorter arms (making them move slightly more realistically) and when they catch the fly the fly respawns in the middle. Also, I've added a bit of code so that if you hold spacekey it won't spawn loads of creatures - it just spawns if you keep repressing it.

Enjoy!

<DOWNLOAD NO LONGER MOST RECENT VERSION - CHECK LATER POSTS>

Simple... yet fun!

Attachments

Login to view attachments
Wiggett
21
Years of Service
User Offline
Joined: 31st May 2003
Location: Australia
Posted: 12th Jun 2005 20:03
holy crap! insect zombie men crawling in the most bizzarest fashion! i'm sure to have nightmares tonight. seriously though it looked way freaky the way the stick figures were walking, but if thats an indication of the animation for your game then w00t, keep it up.

robo cat
20
Years of Service
User Offline
Joined: 23rd Feb 2004
Location: In a cat litter tray, near you...
Posted: 12th Jun 2005 21:18
Thanks for the reply!

@ Baggers - I think I've solved the problem about getting the 3 angles between 2 points in 3D space. Will be able to start on a 3D version now.

Simple... yet fun!
Baggers
20
Years of Service
User Offline
Joined: 31st May 2004
Location: Yonder over dem dere hills
Posted: 12th Jun 2005 21:34
Awesome, i cant wait to see it !

Robot
20
Years of Service
User Offline
Joined: 27th May 2004
Location:
Posted: 12th Jun 2005 22:08
Same here I am really looking forward to it.

The happenings of tommorow are behind us now
robo cat
20
Years of Service
User Offline
Joined: 23rd Feb 2004
Location: In a cat litter tray, near you...
Posted: 12th Jun 2005 22:19
Just realised there was a mistake in the most recent demo. When I shortened the arms I forgot to change the values used by AI, so the actual AI was behaving as if it had longer arms - I had only changed the length of the limbs. Added in the collision for the limbs on the scenary (not just the ends of the limbs). They now no longer slice through corners of the scenary so now slide realistically around them. This makes for more realistic behaviour and also stops them getting stuck when they wrap themselves around a box. Won't put another demo of it up yet, as I don't want to waste space on the forum server.

Simple... yet fun!
Robot
20
Years of Service
User Offline
Joined: 27th May 2004
Location:
Posted: 12th Jun 2005 22:43
Yay it did look slightly strange when they lifted themselves up with space and now they won't get stuck . How is the 3D version going?

The happenings of tommorow are behind us now
xtom
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Ireland
Posted: 12th Jun 2005 23:17
very cool. Would be nice to see in 3d.
Hawkeye
21
Years of Service
User Offline
Joined: 19th Sep 2003
Location: SC, USA
Posted: 12th Jun 2005 23:39
Woah dude that's seriously cool! I loved it when one guy kept trying to brace himself between the top right block and the wall, it was like he was trying to chimney climb the wall or something.

This is the kind of thing that gets in the newsletter

Kohaku
20
Years of Service
User Offline
Joined: 3rd May 2004
Location: The not very United Kingdom
Posted: 13th Jun 2005 01:03
It would be neat if you could control the little, round thing, with your mouse. And I have to say, I prefer the original. They seem to have more "life" in that one.

You are not alone.
robo cat
20
Years of Service
User Offline
Joined: 23rd Feb 2004
Location: In a cat litter tray, near you...
Posted: 13th Jun 2005 02:59
Thanks for all the positive replies!

@ Aura - I know what you mean about the original ones with the long arms having more life. Think the arms were too short to contribute much to the body.

At first I did have it following the mouse but I thought it looked better having each creature chasing a different target. What I am planning to do with this engine in my online survival horror, is not just for enemies but the players aswell. I will use 3rd person like a free flight control system. Using the mouse to change the way you face and the arrow keys to set the player body's target either forwards and to the side based on the torso position and the direction faced. This will mean you will have full control over the player's body and will be able to climb onto desks or through an air vent realistically, just by pointing at where you want to go and pressing up.

@ Robot - 3D version is now fully planned, its just a case of sitting down with a bit of time and coding it from notes on pieces of paper.

@ Hawkeye - Not sure if its good enough to get in the newsletter at this stage. Perhaps when its fully working in 3D.

Simple... yet fun!
robo cat
20
Years of Service
User Offline
Joined: 23rd Feb 2004
Location: In a cat litter tray, near you...
Posted: 13th Jun 2005 03:12 Edited at: 15th Jun 2005 01:49
Thought I might aswell attach the latest version - seeing as the zips are less than 300KB - this will likely be the last version before the 3D one. Its got the original length arms - same as the first version - the creatures eat the flies still. The FPS is locked to 60 in this version still. The only change, which makes the creatures look much more realistic, is that the limb collision has the enhancement where it won't slice through the scenary and slides across the corners instead.

Enjoy!

<MOST RECENT DOWNLOAD - ENJOY >

Simple... yet fun!

Attachments

Login to view attachments
TEH_CODERER
21
Years of Service
User Offline
Joined: 12th Nov 2003
Location: Right behind you!
Posted: 13th Jun 2005 03:26
Woah! When I finally quit that application 50 years had gone past my house had been demolished and all my family were dead! That is so fun to watch!

[url]andrewneale2004@yahoo.com[/url]
http://www.elbsoftware.tk
Kohaku
20
Years of Service
User Offline
Joined: 3rd May 2004
Location: The not very United Kingdom
Posted: 13th Jun 2005 07:04
That sounds like a swell idea robo cat. That's a really interesting control method you have lined up there.

You are not alone.
Hawkeye
21
Years of Service
User Offline
Joined: 19th Sep 2003
Location: SC, USA
Posted: 13th Jun 2005 07:41
A little something you ought to fix--when the flies are hanging around in the very center of the screen, the ragdolls just stand there and sway a little bit, not making an attempt to get to them. You might comsider having something where if the ragdoll has the option of going farther away from its quarry instead of always homing in on it--say perform a check every two seconds that sees if he made any progress towards his prey.

So, maybe:

displacement of fly - displacement of ragdoll
if > 0 then if rnd(1) = 1 then head for a random place rnd(20) units away from target
else continue heading for fly


Just a thought

robo cat
20
Years of Service
User Offline
Joined: 23rd Feb 2004
Location: In a cat litter tray, near you...
Posted: 13th Jun 2005 18:44
Quote: "Woah! When I finally quit that application 50 years had gone past my house had been demolished and all my family were dead! That is so fun to watch!"


Thanks, glad you liked it.

Quote: "That sounds like a swell idea robo cat. That's a really interesting control method you have lined up there."


Its inspired by the game Hitman 2. However, the special movement algorithm means that it will be able to do so much more.

Quote: "when the flies are hanging around in the very center of the screen, the ragdolls just stand there and sway a little bit"


That is a good solution. However, once the movement is done in 3D I am going to add waypoints. The waypoints will just be points in 3D space that the body moves to first. I might use something similar to the A* algorithm. Alternatively, I might use the way point less path finding used in my survival horror and adapt this to the climbing. If neither works well, I can always use your idea - which might work quite well.

Actually, I've just thought of a brilliant new pathfinding method while writing this. It wouldn't be useful for conventional movement methods, but for this it might just work. I'll have a proper design of it on paper and see if it will be fast and effective. It uses a similar principle to what you suggested, but instead does it all the time - without moving the actually creature. It relies on the fact that the creatures can climb anywhere within a certain range of scenary. I'll post up more about it, if I decide to go ahead with it.

Simple... yet fun!
robo cat
20
Years of Service
User Offline
Joined: 23rd Feb 2004
Location: In a cat litter tray, near you...
Posted: 13th Jun 2005 22:57
Had a think about having built in path finding, or leaving it to the user of the algorithm. What I might do is have a ragdoll snake type thing that goes between the creature and its target and basically has systematic spazms and collision until it no longer collides. It would collide with the scenary boxes and also inverted collision boxes slightly larger than the scenary boxes (so it takes the limb range into account and won't try to fly). I'll leave this out though until its working in 3D and the 'action objects' are implimented into the engine.

For those who are wondering... 'action objects' are a system I've designed for the ragdolls to make the ragdolls do cool tasks - such as raising ladders up to windows (and knocking them down), opening / closing doors, flicking switches / turning cranks to lower bridges, wielding weapons and reloading etc, grabbing other ragdolls and pulling them towards you / throwing them off a bridge etc and even having ragdolls give other ragdolls boosters (putting their hands out) so the other ragdoll can climb up and through an air vent before they turn round and pull the other person up through it aswell. The action objects sound complicated in what they will hopefully achieve but the basic principles are simple.

Simple... yet fun!
TEH_CODERER
21
Years of Service
User Offline
Joined: 12th Nov 2003
Location: Right behind you!
Posted: 13th Jun 2005 23:29
Wow! The whole idea sounds great and I can't wait to see it.

[url]andrewneale2004@yahoo.com[/url]
http://www.elbsoftware.tk
Hawkeye
21
Years of Service
User Offline
Joined: 19th Sep 2003
Location: SC, USA
Posted: 14th Jun 2005 00:44 Edited at: 14th Jun 2005 00:47
Sounds nice I was watching it go a few minutes ago and thought of this--could you do a test like this: if only one limb is touching a block, then jump off in the direction of the fly (impulse)? Just a thought, that way they're not swinging off on one limb for 10+ seconds waiting for the fly to move somwehere else

edit: oh yeah, and do you have any plans for releasing the source? Maybe for the 2d version, after you release the 3d version... I dunno, just a thought--I had this crazy idea of stick figure fights So, all ragdolls are controled via the physics engine and invisible flys--you move the 'player's fly' around with the mouse, click to shoot, rmb for kantana swipe. Just a crazy idea

robo cat
20
Years of Service
User Offline
Joined: 23rd Feb 2004
Location: In a cat litter tray, near you...
Posted: 14th Jun 2005 01:56
Quote: "if only one limb is touching a block, then jump off in the direction of the fly (impulse)?"


I'm going to limit the strength of a limb on a surface (ie grip) based on its angle to the centre of gravity of the body. This will mean when the creature holds on to the wall with one leg and is extended sideways it will have little grip and just fall off anyway. As for jumping I'm not sure if I'll leave this out for the time being - perhaps after I've decided what I'm doing about the path finding.

Quote: "do you have any plans for releasing the source?"


I've not decided about releasing the source etc. It really depends on how well it works when its all finished in 3D. I might want to hold on to it and release the system to people in the same way that people do with commercial physics engines. It really all depends on the quality of it. If it does work perfectly and can potentialy bring a lot to professional games, I may want to sell it for use by professional developers. Although I could release the 2D source, it still contains all the clever tricks in it which the 3D version will utilise. I want it to be as publically available as possible for people to use - but I want to make sure I don't lose any future oppurtunities that could be later possible.

Quote: "you move the 'player's fly' around with the mouse"


What works quite nicely is having the arrow keys / joystick / mouse movement offseting the target from the creatures head. It lets the player have a great level of control over the creature climbing - more than with standard animation methods. Nice idea about the 2D fighting game. The katana could be done using an action object so it follows set swings in any direction (once they are implimented). The arms / legs can be disabled by the program using the system and the movement will compensate - meaning the user of the system will be free to use limbs for whatever purpose and the movement system will adapt. In theory it could be used for all kinds of games.

Simple... yet fun!
Hawkeye
21
Years of Service
User Offline
Joined: 19th Sep 2003
Location: SC, USA
Posted: 14th Jun 2005 23:02
Quote: "This will mean when the creature holds on to the wall with one leg and is extended sideways it will have little grip and just fall off anyway"


Good plan, I thought stuff like this was a little surreal... maybe if the zombies stood in industrial strength glue for a few seconds so they stuck to everything they touched?



Quote: "but I want to make sure I don't lose any future oppurtunities that could be later possible."

Aggghhhh... I was hoping you wouldn't say that... as it is, this may be the one plugin I'll buy (presuming you ever sell it) But I'm not interested one whit in the 3d edition is the only thing, I just want to get intelligent ragdolls into a stick game! I can see in my mind how it'd work...

Anyhow, if you DO indeed sell it, make sure you include the 2d edition!

robo cat
20
Years of Service
User Offline
Joined: 23rd Feb 2004
Location: In a cat litter tray, near you...
Posted: 14th Jun 2005 23:49
Its not so much a question of selling it if it turns out to be good, but a question of just wanting to have the system copyrighted so if people used it then the credit would remain with me. If I was to release the source at this early stage then there would be nothing to stop someone taking the methods used by this early version and finishing the 3D version before me - thus being able to take the copyright and credit unfairly. I'm not bothered about making money from the idea, but just getting credit for it. Being able to put my name next to a popular AI system (if it does somehow turn out to be popular) would have immense benefits in later life (such as getting a career as a games programmer). I'll release the source and the secrets of the system when its finished enough for me to claim the credit for the system. Also, I will make sure the 2D version isn't destroyed and is updated to meet changes made in the 3D version.

Simple... yet fun!
dj blackdragon3710
20
Years of Service
User Offline
Joined: 5th Nov 2004
Location: In LaLa land
Posted: 15th Jun 2005 01:01
haha!!! I had so much fun watching this Robocat . Good job.

Heres a piccy of what I got .

<<<<<Used to be "djblackdragon" with being registered in January, 2003, no matter what it says on the left<<<<<

Attachments

Login to view attachments
Hawkeye
21
Years of Service
User Offline
Joined: 19th Sep 2003
Location: SC, USA
Posted: 15th Jun 2005 01:19
:o Cool! I didn't know the ragdolls could walk on the ceiling...

dj blackdragon3710
20
Years of Service
User Offline
Joined: 5th Nov 2004
Location: In LaLa land
Posted: 15th Jun 2005 01:34
I know . I originaly thought he was going to do a back flip or something, then I saw that he jumped to the ceiling. Anyway, again, good job Robo.

<<<<<Used to be "djblackdragon" with being registered in January, 2003, no matter what it says on the left<<<<<
robo cat
20
Years of Service
User Offline
Joined: 23rd Feb 2004
Location: In a cat litter tray, near you...
Posted: 15th Jun 2005 01:47
Thanks for the comments!

Although they can climb on the ceiling, they don't do it often because once their target drops below them they will fall down.

@dj blackdragon3710 - by the way, it looks as though you were using the 1st version, not the most recent 3rd version, as the frame rate is 151 and one of the ragdolls is slicing through one of the collision boxes. I'll edit my previous posts now to make sure people don't download older version.

Simple... yet fun!
dj blackdragon3710
20
Years of Service
User Offline
Joined: 5th Nov 2004
Location: In LaLa land
Posted: 15th Jun 2005 02:34
heh, ok. Thought I had the right one .

<<<<<Used to be "djblackdragon" with being registered in January, 2003, no matter what it says on the left<<<<<
Sergeant Sapwood
19
Years of Service
User Offline
Joined: 12th May 2005
Location:
Posted: 15th Jun 2005 13:15
Well dude i think that is about the coolest thing ive ever seen!! I am looking forward to the finished product almost as much as the 6th harry potter book lol! Gl with project!

Sapwood of the elite fighting force of hares known as the Long Patrol
New World Order
20
Years of Service
User Offline
Joined: 31st Oct 2004
Location:
Posted: 16th Jun 2005 00:34
wow this is really amazing..... if you implement the final 3d-version into your online survival-horror-project, its simply gonna RULE!
good luck with all of this

"Wise men talk because they have something to say; fools, because they have to say something." -Plato
robo cat
20
Years of Service
User Offline
Joined: 23rd Feb 2004
Location: In a cat litter tray, near you...
Posted: 16th Jun 2005 00:37
Thanks for all the comments!

As I said earlier, the only thing halting progress with the 3D version is finding the 3 angles between 2 points in 3D space (aswell as the amount of non darkbasic stuff going on over the next couple of weeks). Anyway, I've finally got a function that works like a 3D version of atanfull when using the default order of rotation. Took quite a lot of work and maths to solve it, so I'll post it up for other people who might want to use it:



It is quite trig heavy so should be used as little as possible (unless you use trig look-up tables in your code). The FReturn(1) array is just an array I always have in my code so I can return multiple values from a function without having to get them one at a time by specifying a flag parameter. Dist_x# etc are the distances between the 2 points in 3D space. The total length of the distance is assumed by the function to be 1 (to speed things up and keep it simple). Simply divide the parameters you are passing in by the total length to achieve this. The angles returned, if applied to an object means that if it moved forwards by 1 then it would move the distances passed into the function. The similar_x# etc are the set of angles that you want the solution to be nearest to. Since there are multiple angle combinations that could be returned, it picks the combination most similar to the angle combination passed into the function. If you were using this to rotate an object, then you would pass the object's current angles into the function to stop it from rotating suddenly to an obscure angle combination. I think it all works, as I've tested it with lots of random combinations and it worked for them all. Hope you find it useful!

Simple... yet fun!
Peter H
20
Years of Service
User Offline
Joined: 20th Feb 2004
Location: Witness Protection Program
Posted: 16th Jun 2005 04:20
Quote: " I can also add and remove limbs/joints on the fly and it won't get confused"

perfect for blowing a zombie's leg off then seeing him still limp towards you!

"We make the worst games in the universe."

Hawkeye
21
Years of Service
User Offline
Joined: 19th Sep 2003
Location: SC, USA
Posted: 16th Jun 2005 06:36 Edited at: 16th Jun 2005 06:36
My thoughts exactly


`````perpare to die!

aaaaaa!


```haha sucker!





Login to post a reply

Server time is: 2024-11-23 05:39:48
Your offset time is: 2024-11-23 05:39:48