Clamp a direction vector in a cone?

Hi!
I want to add tilt a stick standing straight up, but with limits to the rotation. I get the target rotation from the look at function, and the cross just makes it point up. This vector I’d like to clamp somehow within a certain range from 0,0,1. I’d attempt that over manipulating the rotation values, because of the difficulty of working with rotation values.

How could I do this? Or do you have a solution using rotators instead?

Why not just go straight for

image

Constrain the vector in the code, but thne use lookat to align the stick ( assuming its X is pointing along the stick )

Wont that output a random vector in the cone? I want a specific one based on user mouse input:

I might have it, trying to do this in BP: Clamp a 3d Rotation - #2 by dthecoolest - Scripting Support - Developer Forum | Roblox

This does seem to work fine :slight_smile: :
Make 3 new Pure functions:

Ah, sorry, I thought it was supposed to be random, I didn’t know control was involved :slight_smile:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.