Game Development Community

Funny thing this swiming action...

by Kevin Mitchell · in Torque Game Engine Advanced · 12/21/2008 (8:59 am) · 16 replies

I cant seem to get the swiming code resource to work and I think its because its not detecting my water collision for :onEnterLiquid

If i put a stop in the code and in the torsion ID for entering the water I get no call for the breaks. any idea why this is happening?

Also my custom character does not turn blue but when I swap to the Spacesuit guy he turns blue. not sure whats going on...

#1
12/21/2008 (9:22 am)
Your custom character needs to be exported with it's bitmap texture in a certain naming convention.

Name your 'base' texture bitmap....with a "baseDOT" prefix.

For example: the current SDK 'KORK' player.dts shape has it's bitmap texture called, "player.png". Currently, this would not allow for any setSkinName callings to work.

You would need to rename your bitmap texture in the material to "baseDOTplayerDOTpng", and export. Not sure why the stock SDK isn't setup like this?!? I have a KORK DTS shape that works like this, merely takes reexporting with proper bitmap texture name. Now, he'll turn any color/texture I want!

Then for swapping textures, you would name additional bitmaps along this naming convention[now, moving beyond the 'base' element string]. Say, you had Team play and the two hues you're using are RED and BLUE. You would generate two new bitmaps...and name them, "REDDOTplayerDOTpng", and "BLUEDOTplayerDOTpng". This will enable the 'swapping' setSkinName calling to work...

Good luck!
#2
01/01/2009 (3:27 am)
Has anyone else gotten swimming working in tgea?
#3
01/01/2009 (6:57 am)
Yeah, got it working a treat in 1.7.1, easy enough, used the swim, crawl, crouch resource, so got them all working ok
#4
01/01/2009 (6:59 am)
@deepscratch: Care to share? :) I've been having issues with swimming in 1.7.1 as well.

Edit: Interesting, I put the same resource in and it still doesn't work... Hmmm...
#5
01/01/2009 (6:59 am)
Which resource did you use, I've tried the one in Resources and the method in the Torque motion bundle and nothing works.
#6
01/01/2009 (7:16 am)
Sure, I'll put something together, in the meantime heres a screenshot. as I said, I used the swim, crouch, crawl resource http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=4348

[IMG]http://img70.imageshack.us/img70/4518/swimminghq4.th.jpg[/IMG]
#7
01/01/2009 (7:29 am)
Also, when using that resource, just follow the instructions, then read the entire thread, all the answers are there. when finished add this resource http://www.garagegames.com/mg/forums/result.thread.php?qt=67852

keep trying on your own, it'll take me a bit of time to clean out all the extra code from my player files, ( I've added so many other things to player already)
#8
01/01/2009 (6:05 pm)
Got it working with a cobbled-together version of this resource. Works for the most part on it's own.
#9
01/02/2009 (8:20 am)
Ok I got something ... but now when i get in the water soon as i start to swim im bounced 10 feet into the air... Do i have to change the mass of my player?
#10
01/02/2009 (9:55 am)
I played with the density setting with the resource I linked to, as well as taking the swimming piece and basically replacing calculateSwim()'s innards with it. I found that the last line in calculateSwim()- the one that adds wtrSurface to acc, is the line that makes you bounce. Once that is commented out, then both sets of code are somewhat similar in results in my experience, but you do have to play with it. While the code is still not perfect (I need to orient the body to the vector it's swimming in, get a tad bit more acceleration, and get the treading water animation to play when bobbing at the surface), it works well enough to test things.
#11
01/02/2009 (10:01 am)
I just found that like as well Is this a private forum section to share my code changes?

Edit: Guess not i just say (Public forum)

But I have a hard coded Z acceleration to 0.1 is in motion and -0.3 if not in motion.

Now im looking for the area where you can make him stay in root form when not swiming. so i can control sink and surface.
#12
01/02/2009 (10:06 am)
"Torque Game Engine Advanced (formerly TSE) Public Forums"

You can do a post in the private forum and post the link here, so everyone who has the SDK can view it.
#13
01/02/2009 (10:08 am)
Ill do that once i get this fully working. I'm just so grateful to deepscratch for his help.
#14
01/02/2009 (11:14 am)
Well I decided i didn't need to surface and sink ability got my game but it was easy to implement if you just change that accVec.z to positive and negative static numbers depending on movespeed being 0 or > 0 and using a jetting trigger with canSwim function to apply a positive impulse to the accVec.z to surface to the top of the water.
#15
01/03/2009 (3:23 am)
Ok, I've posted my player.cpp and player.h files in the private forums.
you'll have to wade through them, or do a diff with winmerge to extract the relevent code.
I left all my other changes in the files(physx, decals, melee, player explosion stuff and more, so dont just copy paste. if ya'all want to get the other stuff in, discuss it in that thread).
one other thing might be nice to leave in is the rotation animation, like when you turn while standing, he does some subtle footwork.

this is the thread

http://www.garagegames.com/mg/forums/result.thread.php?qt=82116
#16
01/03/2009 (3:32 am)
Thanks ill look into it.