Question about Stevie G's code.

Blitz3D Forums/Blitz3D Beginners Area/Question about Stevie G's code.

Cubed Inc.(Posted 2010) [#1]
About a week ago, I saw a post of some user asking how to do standard 3rd person controls (mario 64) and the user Stevie G posted this code



The only problem with this code was that the players speed is faster when he is pointed at and angled direction that he is when pointed left and right or front and back.

Another user whose name I cannot remember fixed this problem so that it doesn't do that.

Now that I am looking for the thread that had this, I can't find it. Maybe it was in the programmers section instead of the beginners area, although I checked.

If anyone knows about the thread that I am talking about or if stevie g sees this, can you tell me what happened to the thread and where it is?

Last edited 2010

Last edited 2010

Last edited 2010


puki(Posted 2010) [#2]
About a week ago

Are you sure it was him?

http://www.blitzbasic.com/Community/userposts.php?user=5891


Cubed Inc.(Posted 2010) [#3]
puki
Its definintly his code. I'm trying to find the thread that had the problem with stevie g's code fixed.


Stevie G(Posted 2010) [#4]
Hi,

It's just a case of normalising the Mx + Mz variables before movement. See below:

	If Mx <> 0 Or Mz <> 0
		;normalise direction
		D# = Sqr( Mx * Mx + Mz * Mz )
		Mx = Mx / D 
		Mz = Mz / D
		;move relative to camera
		TFormVector Mx, 0, Mz , CAMERApivot , 0
		TranslateEntity CUBE, TFormedX(), 0, TFormedZ()
		;turn relative to movement
		PositionEntity TARGET, EntityX( CUBE ) + TFormedX() , 0, EntityZ( CUBE ) + TFormedZ()
		TurnEntity CUBE, 0 , DeltaYaw( CUBE, TARGET ) * .25, 0
	EndIf



Cubed Inc.(Posted 2010) [#5]
Stevie G
The code I saw was different and even simpler. The guy did the same thing with your code, except he used a variable named speed. I'm trying to take the fixed version of your code, and add acceleration( like when a car moves )


Stevie G(Posted 2010) [#6]
Why not use the search facility? I searched for "Mario 64" and this is the first post I found that I had been involved in:

http://www.blitzbasic.co.nz/Community/posts.php?topic=62205#695441

Here is a car thing I posted a looong time ago - not sure if this is the kind of thing you are after..




Cubed Inc.(Posted 2010) [#7]
Stevie G

Would you have happen to remember any other posts that you have posted in? The version of your code that I am looking for was in a post of someone asking how to create a control system like in mario 64.

I'd be extemely grateful if you did.

P.S That car example is fantastic. I really like the zooming and panning that the camera does.

Last edited 2010


Stevie G(Posted 2010) [#8]
Search for "Mario 64" in all forums and hunt through the posts like I did.


Cubed Inc.(Posted 2010) [#9]
Stevie G
I found it, but could you help me with one more thing.
The reason why I wanted to find the code was becuase I wanted to add "acceleration" to it, like when a person runs.




I was able to add the acceleration when the player moves forward, but when the player stops, the player stops dead on his tracks, were when a somebody whos running stops, they don't just stop like that.

How could I fix this?

Last edited 2010

Last edited 2010


Stevie G(Posted 2010) [#10]
Like this?




Cubed Inc.(Posted 2010) [#11]
Stevie G
It's almost perfect. The only problem with it is that now you turn too slowly and when you turn left and right, it doesn't turn all the way.

Would you by any chance be able to fix it?

Sorry for asking for so much but it so close to perfection that I can't help but to ask.


Stevie G(Posted 2010) [#12]
Increase the .15 in this line of code to a number between 0 and 1 which suits.

TurnEntity CUBE, 0 , DeltaYaw( CUBE, TARGET ) * .15, 0


Cubed Inc.(Posted 2010) [#13]
Stevie G
It didn't work.
Would it be possible for you to keep the turning from edit#9 and also keep the acceleration and drag from post #10?

I'd really appreciate it.


Robert Cummings(Posted 2010) [#14]
At this point you should begin trying to understand why that code works so you can become self-sufficient...


Stevie G(Posted 2010) [#15]
@ TaGames,

I think this is what you're looking for..



I think I've helped you enough for now. As Robert says, it's time to help yourself and have a play about with the code and try to understand what is going on.

I'm not coding your game for you I'm afraid.

Cheers
Stevie

Last edited 2010


Cubed Inc.(Posted 2010) [#16]
Stevie G
I wasn't expecting you to code my game, I just wanted to ask a few questions.

Thanks for all the help. It was greatly appreciated.