Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
7 registered members (EternallyCurious, 7th_zorro, Ayumi, Quad, AndrewAMD, ricky_k, 1 invisible), 497 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, 11honza11, ccorrea, sakolin, rajesh7827
19046 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Movement #472942
06/01/18 02:12
06/01/18 02:12
Joined: May 2018
Posts: 7
L
LaserJock2000 Offline OP
Newbie
LaserJock2000  Offline OP
Newbie
L

Joined: May 2018
Posts: 7
I have a car entity on an arena. The car drives well with my joystick however I want to drive it in a relative vice absoulute fashion.
AKA: I want the car to drive forward based on entity not world coordinates. I have tried both:
pXent_move(me, vector(my.x -= joy_axis(1,2) * .01, my.y -= joy_axis(1, 1) * .01, my.pan -= joy_axis(1, 4) * .01), nullvector);

and

c_move(me, vector(my.x -= joy_axis(1,2) * .01, my.y -= joy_axis(1, 1) * .01, my.pan -= joy_axis(1, 4) * .01), nullvector, GLIDE);

The car always drives in world coordinates.

Any ideas?
Thanks

Re: Movement [Re: LaserJock2000] #472946
06/01/18 07:10
06/01/18 07:10
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
Hi,
pXent_move moves physx actors with no collision detection. On pX, actors are moved with forces. pXent_addforcelocal adds forces in object space.

Salud!

Re: Movement [Re: txesmi] #472947
06/01/18 08:15
06/01/18 08:15
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Kartoffel Offline
Expert
Kartoffel  Offline
Expert

Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
what txesmi said, unless you're using a kinematic character. In that case you have to use pXent_move().


POTATO-MAN saves the day! - Random
Re: Movement [Re: Kartoffel] #472963
06/03/18 01:35
06/03/18 01:35
Joined: May 2018
Posts: 7
L
LaserJock2000 Offline OP
Newbie
LaserJock2000  Offline OP
Newbie
L

Joined: May 2018
Posts: 7
Good point. Here is my code. The car drives but goes through the arena walls and is always in world coordinates.

////////////////////////////////////////////////////////////////////
#include <default.c>
#include <ackphysx.h>
////////////////////////////////////////////////////////////////////

// joyNum 1/2, axisNum 1-6
var joy_axis(int joyNum, int axisNum)
{
VECTOR *source[2];

if(axisNum < 1 || axisNum > 6) return 0;
if(joyNum == 2)
{
source[0] = &joy2_raw;
source[1] = &joy2_rot;
}
else
{
source[0] = &joy_raw;
source[1] = &joy_rot;
}
axisNum--;
var *pv = source[axisNum/3];
return pv[axisNum%3]; // read var at x,y,z
}

function main()
{
VECTOR Car1;
ENTITY* Car1;
ENTITY* Level1;
physX_open();
video_mode = 12;
level_load ("2018_arena_MKIII.wmb");
Car1 = ent_create (Car1, vector(64, 100, 2.5), NULL); // create the Car
Level1 = ent_create ("2018_arena_MKIII.wmb", vector(0,0,0), NULL);


wait (2);

}
action move_me()
{
while (1)
{
pXent_move(me, vector(my.x -= joy_axis(1,2) * .01, my.y -= joy_axis(1, 1) * .01, my.pan -= joy_axis(1, 4) * .01), nullvector);
wait (1);
}
}

Re: Movement [Re: LaserJock2000] #472964
06/03/18 08:55
06/03/18 08:55
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Kartoffel Offline
Expert
Kartoffel  Offline
Expert

Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
you have to register your entities as physics objects


POTATO-MAN saves the day! - Random
Re: Movement [Re: Kartoffel] #472977
06/04/18 20:16
06/04/18 20:16
Joined: May 2018
Posts: 7
L
LaserJock2000 Offline OP
Newbie
LaserJock2000  Offline OP
Newbie
L

Joined: May 2018
Posts: 7
Thanks. Umm. How do I do that please?

Re: Movement [Re: LaserJock2000] #472980
06/04/18 20:29
06/04/18 20:29
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Kartoffel Offline
Expert
Kartoffel  Offline
Expert

Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Take a look at the physics workshop at http://tutorial.3dgamestudio.net/ wink


POTATO-MAN saves the day! - Random

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