Gamestudio Links
Zorro Links
Newest Posts
Help with Data import to T1
by AndrewAMD
45 minutes 48 seconds ago
Using ":L" & ":S" causes 2 possible bug(s) or is it bad coding?
by AndrewAMD
Today at 03:54
Correlation -1.#IND00
by AndrewAMD
01/21/19 17:37
Basic thread safety question
by Superku
01/20/19 18:15
Blog Post: Get Historical Data from Darwinex REST API w/ Zorro
by AndrewAMD
01/19/19 22:19
Reseting a static variable - the next day
by OptimusPrime
01/19/19 19:48
Train algorithms separatery
by 3dgamelight
01/18/19 10:37
AUM Magazine
Latest Screens
Worst Case Z
AckCon'18 - Lotter vs the World 2 - Preview Release
Evonet Beta v1.0 : Online Project Development Template
Lake scene
Who's Online
12 registered (Iglarion, AndrewAMD, Michael_Schwarz, ags, chsmac85, kvm, ibne, alibaba, 3 invisible), 431 Guests and 6 Spiders online.
Key: Admin, Global Mod, Mod
Newest Members
laz, ramonne, SibJac, Evael, NRW
18156 Registered Users
Topic Options
Rate This Topic
#472942 - 06/01/18 04:12 Movement
LaserJock2000 Offline
Newbie

Registered: 05/13/18
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

Top
#472946 - 06/01/18 09:10 Re: Movement [Re: LaserJock2000]
txesmi Online
Serious User

Registered: 06/13/07
Posts: 1201
Loc: 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!

Top
#472947 - 06/01/18 10:15 Re: Movement [Re: txesmi]
Kartoffel Offline
Expert

Registered: 06/11/09
Posts: 2210
Loc: 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

Top
#472963 - 06/03/18 03:35 Re: Movement [Re: Kartoffel]
LaserJock2000 Offline
Newbie

Registered: 05/13/18
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);
}
}

Top
#472964 - 06/03/18 10:55 Re: Movement [Re: LaserJock2000]
Kartoffel Offline
Expert

Registered: 06/11/09
Posts: 2210
Loc: Bavaria, Germany
you have to register your entities as physics objects
_________________________
POTATO-MAN saves the day! - Random

Top
#472977 - 06/04/18 22:16 Re: Movement [Re: Kartoffel]
LaserJock2000 Offline
Newbie

Registered: 05/13/18
Posts: 7
Thanks. Umm. How do I do that please?

Top
#472980 - 06/04/18 22:29 Re: Movement [Re: LaserJock2000]
Kartoffel Offline
Expert

Registered: 06/11/09
Posts: 2210
Loc: Bavaria, Germany
Take a look at the physics workshop at http://tutorial.3dgamestudio.net/ wink
_________________________
POTATO-MAN saves the day! - Random

Top


Moderator:  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