Download

Orient character along surface

Hi, I’m have a sphere which is at 0,0,0 and I’ve made a radial force component to pull objects towards the centre like gravity.
I’ve turned gravity to 0 so the player doesn’t fall, It gets pulled to the surface of the sphere.

Is there anyway I can orientate the character to the surface of the sphere? Or even just make it so the characters z axis is always pointing towards 0,0,0?
I’m currently running a trace from the character to 0,0,0 but I’m not sure how to use the normal to rotate the character so it’s standing on surface.
I kind of want “Find look at rotation” but for the Z axis.

Any one got any ideas?

Thanks

Won’t setting the characters rotation to the trace normal work?

It’s this part I seam to be having trouble with

This is a shot in the dark

And this is what happens with the shot in the dark

How would I go about setting the characters rotation to the trace normal work?

Thanks!

This seams to have done the trick

5f75a1e151556af018001c1dfe49c89cfff64781.jpeg

Now I need to rotate the camera or camera arm the same as the character.

Also The character still falls off the edge like so

When the character falls off the edge it doesn’t return to the standing state even if its on top of the sphere.

Lots of things to figure out! :stuck_out_tongue:

Is there any way I can make the walkable floor angle in the CharacterMovement component to 360 or turn it off? The maximum I can change it to is 90 which still results in the character falling off the edge.

I can untick “Can Walk Off Ledges” but that only allows the character to walk on the top half of the sphere.

Any suggestions?

Thanks

I havent used the ACharacter class yet.

Could you set the cameras roll to be the same as the mannequin?
If the camera is attached to a spring arm you could try setting the spring arm to have the same roll as the mesh.

If you don’t come right, I can start experimenting with this if you want.

HTH

What is you trace every tick and enforce your own gravity(you will have to disable gravity first on the player) on the player?
That way you can walk around the sphere with the player’s feet on the sphere and have him fall towards and orianted to the sphere.

Currently the trace just orients the character to the surface of the sphere. What would work better is if the character is orientated to the centre of the object.

The character does have gravity set to 0 and the sphere just has a radial force component pulling the character in.
The above video shows this and this where I’m currently at with it.

I have acquired a a custom character movement component which orientates the character to the surface of any object and allows is to walk on it but it doesn’t allow for the character to fall off cliffs or anything like that, The character just orientates it’s self with the side of the cliff which is not really what I want so I don’t think I’ll be using it.

Ryan would be able to post an example bp of getting the character to run around a sphere shape? My BP has nothing special in it. Just world gravity set to 0. The character grav multiplier set to 0. and the BP above shows how the character is oriented depending on where it is at.

Thanks

Here are the project files:
https://www.dropbox.com/s/67q33s6uj5s1hen/Planetoid.zip?dl=0
Literally all I’ve done is added force to a sphere and edited the ThirdPersonBP.

I’ve done some tests, So far it looks like the character class has to be edited to allow you to walk on any surface.

You can check out this for what you want.
It seams that the author( I assume it is the same one) is working on getting this added to the engine, But I don’t know if/when that will happen(probably in 4.13 at the earliest if it does happen).

I will continue my experiments with this.

HTH

So using the plugin you suggested I’ve made some quick planets and I’m going to start playing around.

I would like to figure out a way of stopping the character from walking up walls. At the moment the character is facing upwards from the normals. So if I added something like a building the character would adjust to the orientation of the wall.

I have not tried the plugin myself yet.

Possible solutions:
-You could ask on the plugins thread
-Put a blocking volume on the walls to stop the player from touching it
-See if you can hook into the method(s) that reorient the player.

HTH