Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About Vehicle #18

Open
lo-th opened this issue Nov 24, 2022 · 13 comments
Open

About Vehicle #18

lo-th opened this issue Nov 24, 2022 · 13 comments

Comments

@lo-th
Copy link

lo-th commented Nov 24, 2022

Hello great port of 5.1 the speed up is amazing !
I see you don't expose vehicle function
do you plan to add them that would be great.

@fabmax
Copy link
Owner

fabmax commented Nov 24, 2022

Yes I'm currently on that. The vehicle API has changed significantly compared to 4.1 so it's quite a bit of work...

@lo-th
Copy link
Author

lo-th commented Nov 25, 2022

Awesome, i hope they have simplified vehicle API because it was not easy to use

@lo-th
Copy link
Author

lo-th commented Jan 4, 2023

Hi happy new year
thank's for adding vehicle is great
i have little missing and i don't find value in doc
vehicle.get_transmissionCommandState().set_targetGear(PxVehicleEngineDriveTransmissionCommandStateEnum.eAUTOMATIC_GEAR.value);
eAUTOMATIC_GEAR is not exposed, what the value ?

@fabmax
Copy link
Owner

fabmax commented Jan 4, 2023

Hmm, I think it is exposed...
Anyway, in the Nvidia docs you can click on the file name and then show source to see the actual values:
https://nvidia-omniverse.github.io/PhysX/physx/5.1.2/_build/physx/latest/program_listing_file_include_vehicle2_commands_PxVehicleCommandStates.h.html#program-listing-file-include-vehicle2-commands-pxvehiclecommandstates-h

For eAUTOMATIC_GEAR it is 0xff

@lo-th
Copy link
Author

lo-th commented Jan 4, 2023

ok thank's
have to experiment now my car seem's go forward ?
front wheel is 0 1 or 2 3 ?

i wan't control car with keyboard
is with
vehicle.getCommandState().setThrottle(1); // key for acceleration
vehicle.getCommandState().setNbBrakes(0);
vehicle.getCommandState().setSteer(0); // for turn

@fabmax
Copy link
Owner

fabmax commented Jan 5, 2023

The front wheels are 0 (left) and 1 (right). The vehicle is controlled via its command state (like you wrote). In order to brake you also have to add a brake command:

vehicle.getCommandState().setNbBrakes(1);
vehicle.getCommandState().set_brakes(0, brakeValue);  // brakeValue between 0.0 and 1.0

@lo-th
Copy link
Author

lo-th commented Jan 5, 2023

ok i use get_wheelRigidBody1dStates(i).rotationAngle to update my wheel mesh
i guess Throttle value is also between 0.0 and 1.0
( for reverser just have to set targetGear to 0 )

do you know how change car shape to custom convex and get physics interaction with other object
i look you initialisation code in java version, wheel shape now work in js is great.

@lo-th
Copy link
Author

lo-th commented Jan 6, 2023

yo ok i find :) how make custom car chassis
physxParams.set_physxActorShapeFlags( new PhysX.PxShapeFlags( shapeflag ) )
physxParams.set_physxActorSimulationFilterData( carQueryFilterData )

@fabmax
Copy link
Owner

fabmax commented Jan 6, 2023

For updating the wheels I would recommend using vehicle.getBaseState().getWheelLocalPoses(i) which also includes the suspension travel, steering etc.

@lo-th
Copy link
Author

lo-th commented Jan 6, 2023

yes but getWheelLocalPoses quarternion is wrong ( position is good )
i use
state.get_wheelRigidBody1dStates(i).rotationAngle // X
i<2 ? command.get_steer() : 0 // Y
state.get_tireCamberAngleStates(i).camberAngle // Z

@fabmax
Copy link
Owner

fabmax commented Jan 6, 2023

It works for me, but if the individual angles work as well that's fine as well

@lo-th
Copy link
Author

lo-th commented Jan 6, 2023

yes you right new version quarternion work

@lo-th
Copy link
Author

lo-th commented Jan 6, 2023

they are something strange on your java setup ( is same as original physx example )
actorShapeLocalPose is ( 0, 0.83, 1.37 )
actorCMassLocalPose is ( 0, 0.55, 1.594 )
move center of mass to front bottom ok
but why move z shape local pose ? that make model only over front wheel ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants