You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I have used the PhysX5.5.0 SnippetVehicle2FourWheelDrive project for reference and completed the function of simulating the movement of the car. However, when I get the linear velocity of the vehicle through the function gVehicle.mPhysXState.physxActor.rigidBody->getLinearVelocity(), a strange phenomenon occurs. When I press the forward button, the vehicle accelerates to a maximum speed of 46.9km/h. This looks good, but as long as I press any key (the forward key is kept pressed), such as "T", the vehicle's speed will increase until it reaches 186km/h. I checked which keys I pressed would trigger events, but the "T" I entered did not trigger any corresponding events. What's going on?
Here are some relevant codes
Key events:
void OnKey(int key, int scancode, int action, int mods) {
if (action == SDL_KEYDOWN || action == SDL_KEYUP) {
// 处理油门、后退、转向
switch (key) {
case SDLK_KP_8:
handleThrottle(action);
break;
case SDLK_KP_2:
handleBackward(action);
break;
case SDLK_KP_4:
handleSteering(action, true); // true 左转
break;
case SDLK_KP_6:
handleSteering(action, false); // false 右转
break;
case SDLK_SPACE:
createDynamic(PxTransform(PxVec3(0, 20, 2), PxQuat(1.0f, 0.0f, 0.0f, 0.0f)), PxSphereGeometry(0.5f), PxVec3(0., 1., 0.) * 10.0f);
break;
case SDLK_LSHIFT:
VehicleShift(action);
break;
// 加速
case SDLK_LCTRL:
VehicleAccelerate(action);
break;
default:
break;
}
// 调用相机控制
cameraControl->onKey(key, action, mods);
}
}
At about 13 seconds in the video, I pressed the "T" key, and then it started to accelerate until it reached about 186km/h. I spent an afternoon troubleshooting, but still couldn't find the real problem. I obviously didn't have any key events related to "T", but in fact it did trigger a certain event. This is really a weird problem.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello, I have used the PhysX5.5.0 SnippetVehicle2FourWheelDrive project for reference and completed the function of simulating the movement of the car. However, when I get the linear velocity of the vehicle through the function
gVehicle.mPhysXState.physxActor.rigidBody->getLinearVelocity()
, a strange phenomenon occurs. When I press the forward button, the vehicle accelerates to a maximum speed of 46.9km/h. This looks good, but as long as I press any key (the forward key is kept pressed), such as "T", the vehicle's speed will increase until it reaches 186km/h. I checked which keys I pressed would trigger events, but the "T" I entered did not trigger any corresponding events. What's going on?Here are some relevant codes
Here is my video demonstration
2.13.mp4
Beta Was this translation helpful? Give feedback.
All reactions