Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, VoroneTZ), 1,258 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: Moving an object [Re: DiegoFloor] #244321
01/04/09 00:51
01/04/09 00:51
Joined: Oct 2008
Posts: 67
pewpew Offline OP
Junior Member
pewpew  Offline OP
Junior Member

Joined: Oct 2008
Posts: 67
thanks schwarz, i'll read over it laugh


HURRR DERP DERP DEERRPP HURR
Re: Moving an object [Re: pewpew] #244327
01/04/09 01:12
01/04/09 01:12
Joined: Jun 2008
Posts: 24
germany --> nrw --> aachen
D
Davidus Offline
Newbie
Davidus  Offline
Newbie
D

Joined: Jun 2008
Posts: 24
germany --> nrw --> aachen
Hi,
You're lucky, i have written an entity move script for myself,
so this may help you:

(Use the WSAD-Keys)
Code:
	VECTOR* vec = vector(0,0,0);
	
	if (key_pressed(17)) // forward
	{
		vec_for_angle(vec,vector(player.pan,0,0));
 		c_move(player,nullvector,vec,IGNORE_CONTENT | GLIDE);
   }
  	if (key_pressed(31)) // back
	{
		vec_for_angle(vec,vector((player.pan + 180)%360,0,0));
 		c_move(player,nullvector,vec,IGNORE_CONTENT | GLIDE);
   }
	if (key_pressed(30)) // rotate Left
	{
		c_rotate(player,vector(0.1,0,0),USE_AXISR);
   }
	if (key_pressed(32)) // rotate Right
	{
		c_rotate(player,vector(-0.1,0,0),USE_AXISR);
  	}	



Important:
You are confusing two concepts:
1. Inbuild Physics
2. (I call it) 'Manual Physics'.

1.) Physics System
If ypu are using the inbuilt physics system, then you give
your object 'out of control' and into the charge of the physics engine - this means that you should no more move your object by yourself.
You normally build wheels to your tank model,
and then build in a motor to turn this wheels.
Or you may simply push your object around -
if it was a ball (check out the ball example in your sample directory of your lite-c installation)
But if you would push your tank around like this, it would only look stupid - believe me, I tried it this way laugh )
A good example for building in wheels and moving the object with that is the bulldozer example
Link:Bulldozer Example on the Aknex ressource side

2.) 'manual physics'
There you move objects yourself - collision detection is
controlled by the flags you provide to the c_move function,
and depending on if an entity has a passable flag.
I personally recommend using the GLIDING flag,
because if you use a non-flat terrain, then your
tank won't get stuck that fast.

Pro for 2: Much faster, easiert to begin with
Downside: Not that nice, and you have to care for general physics by yourself (gravity for example is applied by manually c-moving your objects downside every frame)

I hope that helped a bit,
Davidus

Last edited by Davidus; 01/04/09 01:13.
Re: Moving an object [Re: Davidus] #244373
01/04/09 10:53
01/04/09 10:53
Joined: Oct 2008
Posts: 67
pewpew Offline OP
Junior Member
pewpew  Offline OP
Junior Member

Joined: Oct 2008
Posts: 67
Ohhhh............
david..
i see.
you hit the nail on the head.


i was trying to apply physics to full tank model (only the base was separated from the turret, not the wheels). Then i was trying to use c_move to push the tank around. and it was failing miserably.

I see exactly what you did with c_move, and also understand how i can use absolute and relative speed together to simulate the movement of the tank.

Thanks again laugh


HURRR DERP DERP DEERRPP HURR
Page 2 of 2 1 2

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