Download

Move a camera around an object randomly

Hi,

I’m trying to figure out how to set up a camera that moves randomly around an object. The camera should move keeping the same distance from the object in all directions not only on a plane.

Thanks!

Sounds like Spring Arm is what you are looking for. Attach a camera on it and just rotate. The distance will be the same. Its like orbiting around an object

Thanks, I still need some help with the blueprint.

I have been looking into the Spring Arm and it seems that this may be one way. However, I couldn’t figure out how to make it move it around my object. What I want to achieve is a camera that moves around a static object.

Thanks again

Yeah, you can just rotate the spring arm because the camera is attached to it.

@**Cxrrxj: **Technically, it’s just this:

You never explained what you mean by *random *in the title? Random what? Speed, angle, direction, axis, time intervals?

​​​​​​​Thanks. I’m getting closer but I couldn’t cut it yet. What I need is to change the angle, direction, and axis of the camera randomly over time keeping the same distance from the mesh in a smooth speed.

I tried feeding the Delta rotation with a Rinterp and a Random rotator, but it doesn’t work. The camera moves extremely fast, I tried with different values of Delta time but it doesn’t change too much (I don’t really get what Delta time is). The camera also seems to change from one position to another with no interpolation, it is moving so fast that is hard to tell. In addition, it also seems to change the distance from the mesh overriding the length of the spring arm.

Many things went wrong!

​​​​​​​ ​​​​​​​ ​​​​​​​

Because you are getting random rotator every tick…
Try saving it somewhere then use it as target. I don’t like tick as well. Maybe try with Timeline.

@PhoenixMarket Thank you so much. Definitely this is very close to what I was looking for, but still, it is not working properly. I encountered two problems. On the one hand, for some reasons, the camera doesn’t keep the same distance from the actor, it is like if the spring arm was not doing its job. The camera moves closer and gets away from the actor all the time.

On the other hand, even though the timeline helps to slow down the movement. it doesn’t keep the camera moving at a constant speed, I guess that that is because timeline controls the time that takes to move from A to B, but if A and B are closer the camera will move slower. I was wondering if there is a way to control directly the speed instead of time lapses to feed the lerp.

Many thanks again.

Are you sure that the spring arm is at the center of the object?

Can you also try this and let us know if it solves the second problem.

​​​​​​​​​​​​​​ ​​​​​​​ ​​​​​​​​​@PhoenixMarket The speed set up works like a charm, many many thanks for this. However, the camera keeps moving closer to the mesh, the Spring arm is at the center of the object, I don’t understand what is going on. ​​​​​​​ ​​​​​​​ ​​​​​​​​​​​​​​ ​​​​​​​ ​​​​​​​ ​​​​​​​

Screen-Shot-20181021-at-5.17.16-PM.jpg

​​​​​​​​​​​​​​​​​​​​​

This one is not easy to debug :slight_smile:
Make sure that the camera location is at 0,0,0 all the time.

@PhoenixMarket That was it!! Many, many, many thanks.

Glad I helped :slight_smile:

Dear @PhoenixMarket, I came back to this project and I encountered the same issue. I was wondering if you could take another look at it.

To refresh your mind, I am trying to have a camera that rotates randomly around an object. Following your indications, I set up a SpringArm, but the camera keep moving closer to the object as if the SpringArm wasn’t working. I am attaching some screenshots of the settings of the camera, the spring arm, and the event graph, in case they give you a clue of what is wrong.

Many thanks!

​​​​​​​

Hi,

I think I solved this one. I disabled collision and now it seems to work just fine.

Cheers