How to make a character controller on omniverse

I have loaded a usd file i would like to have a game like navigation in that. for thus made a capsule on a usd file and open up the character controller extension and selected the capsule and set active and selected a velocity camera and start the simulation. WASD works. but mouse movements are not working. when i move the mouse xyz axis spins alot. tried changing the speeds aswell. is there a way to make a character control from python ? has anybody built a first person character on omniverse ?

In Physics Menu, there used to be exactly that. A capsule you could load in, and when you play the animation it would become a live character controller with even physics and colliders. Please check in the physics bundle.

1 Like

Thank you for the reply. I used the physics bundle. i was able find the issue with the rotation problem. i played with some changes inside the extension. if with_camera:
self.min_pitch = -10
self.max_pitch = 10
self.mouse_sensitivity = 0.1
self.gamepad_sensitivity = 0.25
self.pitch = 0.1
self.yaw = 0.1
but still facing the issue with rotation issue. it is not responsive. rotation works only to right side… when we move the mouse to left its not working instantly. without the simulation navigation works fine but no physics. is there a way that we can add physics without simulation ? or can you provide me guidance to make the cc mouse movement responsive ?

I don’t know what is wrong with your mouse. Have you tried disconnecting and reconnecting it? Do you have another device interfering with it? Do you have a game pad installed? The easiest way is using a standard xbox game controller which works incredibly well. I am not sure why you have to program any of this. Viewport navigation is standard and is built in for mouse and xbox controller.

1 Like

hi @kalana, what version are you using right now?

as far as character controller I would suggest you have a look at the Character Controller demo in omni.physx.cct\python\scripts\scenes\CharacterControllerDemo.py, make a copy and change that script to your liking. You can also load the demo by opening the Physics Demo Scenes window through Windows->Physics->Demo Scenes and then looking for the Character Controller section in the treeview and loading the Python demo (that will also enable you to tweak the sensitivity before loading the demo)

setting the pitch/yaw directly in the ControlState’s init does not make sense, since that’s the initial value and should be 0, min and max pitch should stay the same too or at least shouldn’t be limited to such a small value, since those are in degrees (the default limits your up/down rotation between -85 and +85 deg):

if with_camera:
self.min_pitch = -85.0
self.max_pitch = 85.0
self.mouse_sensitivity = 25
self.gamepad_sensitivity = 25
self.pitch = 0
self.yaw = 0

As far as the changes you did to the utility.py script I would revert those, since you can override the sensitivity when setting up the controls when the cct is spawned as you can see in the demo:

           # Setup CCT controls
    self._cct.setup_controls(500, cct_utils.ControlFlag.DEFAULT)
    self._cct.control_state.mouse_sensitivity = mouse_sensitivity
    self._cct.control_state.gamepad_sensitivity = gamepad_sensitivity * 10

not sure about the rotation issue you are describing though, but please try starting with the CCT demo and see where that gets you :)

1 Like

Hi @Richard3D @mhapala
Thank you for responses.
Im using 106.3

I loaded the CC demo extension and now its working fine inside my ec2 instance. navigation is smooth and mouse movement everything is working smooth.

Then i streamed it from the webrtc streamclient extension.

Streaming working well. navigation with right mouse and keyboard bindings are working well.
then i started the simulation and tried to use the mouse. it wont respond. wasdqe keyboard bindings are working as expected.
mouse is not working when i access it from the browser when the simulation is active.

Then i checked on ec2 instance that mouse movements are working fine.

But when i use the webrtc streaming its not working do you have any thoughts on this ? do i have to do some changes in kitplayer.js to activate mouse movements ?

how to fix this issue ?

Just to clarify, you are saying everything is fine when the simulation is not running, but when you hit play, the mouse cursor is frozen, or just the mouse navigation? It could just be that the simulation running live plus navigation is too much for it. One or the other. Do you need to move through a live active simulation, especially running on a remote machine, through a browser? That is a LOT of gates. Even on my own local powerful workstation, if I run a simulation, there is not always an expectation that I can fly through the scene live.

Also, how are you viewing all of this? You are using an EC2, and streaming from where to where? You cannot stream it down directly to your computer, so what are you actually using to view the browser running on the EC2?

Please elaborate on what you are trying to do. Why EC2, not local. Why streaming on the EC2? What are you building? How are you viewing the EC2 feed?

1 Like

Simulation and navigation from a chatacter controller is working fine at the ec2 instance level. from mouse we can rotate look around and with wasd we can navigate

Then Im using webrtc streaming to stream it to a browser . when i access it from the browser like chrome streaming ,simulation navigation from keyboard works well with the right mouse+ WASD i can navigate aswell.

When i start the simulation. when we start the mouse movements are not working .

Im trying to get character controller extension working when streaming to a browser from the webrtc url.

Streaming from where to where and why? The exact details matter. Streaming does NOT cross domains or networks. It is not designed that way. It is only for closed loop systems. So how are you viewing your EC2 and exactly where are you viewing the browser and the stream? What you are trying to do may not work that way.

Streaming from EC2 instance to web browser . theres turnserver configured in the ec2 instance. so that the streaming can be accessed from my personal laptop. Im viewing the ec2 instance with a rdp client.

How the mouse movement are working with right mouse button but not with the simulation?

Ok thank you. You want to use WebRTC instead of RDP or Amazon DCV? You are trying to use WebRTC to get the stream from the EC2 streamed down to your local machine?

Thank you… Yes … I can get streaming running no problem to my local machine. but when when simulation is started for the character controller mouse movements are not working only the keyboard works. its a issue with the streamclient i think.

You have WebRTC successfully streaming from your Cloud EC2 machine down to your local machine, directly? Without the need for an RDP? Wow that is great. Not sure about why the mouse stops working though.