Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (AndrewAMD, TedMar, dr_panther, Ayumi), 1,072 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Player floats above ground. #377205
07/10/11 23:37
07/10/11 23:37
Joined: Jun 2008
Posts: 37
Oklahoma City, OK
emo10001 Offline OP
Newbie
emo10001  Offline OP
Newbie

Joined: Jun 2008
Posts: 37
Oklahoma City, OK
After adding shadows to my model...my suspicion that he was floating was confirmed. I looked at another post here about floating models, but the only answer given was that "something should be a negative number instead".

I'm using the "Improved Player Movement" script from the wiki ( http://www.opserver.de/wiki/index.php/Improved_Player_Movement )

While I think I understand the basics of c_trace...I'm certainly no expert. This is what I'm getting:





I can move my player just fine....but he's always that high above my terrain.

Snippets of the code are
Code:
//determine player height
	c_setminmax(my);
	wait(1);
	var feedheight = -my.min_z;

		//check distance to ground
		grounddist = c_trace(my.x, vector(my.x, my.y, my.z-10000), IGNORE_ME|IGNORE_PASSABLE)-feedheight;
		if(grounddist > 0 || movedir.z < 0)
		{
			//gravity acceleration
			movedir.z += fallacc*time_step;
		}else
		{
			movedir.z = 0;
		}
		
		//apply gravity
		my.z -= minv(movedir.z*time_step, grounddist);
		
		if(grounddist-minv(movedir.z*time_step, grounddist) == 0)
		{
			//jump
			if(key_space)
			{
				movedir.z = -jumpacc;
			}
		}



Any thoughts?


"To one who has faith, no explanation is necessary. To one without faith, no explanation is possible." - St. Thomas Aquinas
Re: Player floats above ground. [Re: emo10001] #377215
07/11/11 08:03
07/11/11 08:03
Joined: Mar 2009
Posts: 88
Walori Offline
Junior Member
Walori  Offline
Junior Member

Joined: Mar 2009
Posts: 88
Make sure your bounding box is correctly shaped (hit f11 two times in a row to check) as this looks like the bounding box is below players feet. For this reason code assumes the player is on the ground even if this wouldn't be the case.

Re: Player floats above ground. [Re: Walori] #377218
07/11/11 08:58
07/11/11 08:58
Joined: Dec 2010
Posts: 63
C
Ceryni Offline
Junior Member
Ceryni  Offline
Junior Member
C

Joined: Dec 2010
Posts: 63
have you tried vec_for_min like in the tutorial for a shooter?
if you cant move anymore set my.z+2 before moving so after it it will be set to ground again and you wont see it.

Re: Player floats above ground. [Re: Ceryni] #377434
07/13/11 02:03
07/13/11 02:03

M
Malice
Unregistered
Malice
Unregistered
M



I had the same problem this change fixed it.

var feedheight = -(my.min_z+2);

play with 2 till you get the right value.

Re: Player floats above ground. [Re: ] #377540
07/14/11 02:50
07/14/11 02:50
Joined: Jun 2008
Posts: 37
Oklahoma City, OK
emo10001 Offline OP
Newbie
emo10001  Offline OP
Newbie

Joined: Jun 2008
Posts: 37
Oklahoma City, OK
Malice that got it. I had to play with 2 a little...but that did it. And it's not allowing me to really adjust my bounding box the way I want it.

Thanks for the heads up. Thanks to everyone who replied. This is a great community


"To one who has faith, no explanation is necessary. To one without faith, no explanation is possible." - St. Thomas Aquinas
Re: Player floats above ground. [Re: emo10001] #378126
07/19/11 22:16
07/19/11 22:16
Joined: Apr 2006
Posts: 159
Latvija
Arrovs Offline
Member
Arrovs  Offline
Member

Joined: Apr 2006
Posts: 159
Latvija
it should use c_move
and vhy feed height at all?
Vizout it vorks good anyvay.
But im just asking, nothing personal.


Arrovs once will publish game
Re: Player floats above ground. [Re: Arrovs] #378129
07/19/11 22:31
07/19/11 22:31

M
Malice
Unregistered
Malice
Unregistered
M



I changed it to c_move in my copy. But you still have to adjust feedheight with a positive number.


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1