This is tricky but I wanted to make some guesses and do some thinking before I just get the answer from the professor.
So we project a beam out from our pawn that sends the data to the processor that calculates what we are about to collide with. Is this like ray casting? Oh so much to learn.
Maybe that ray can talk to or interact with the object in question. That object can have a setting- or better yet a component. The chair can have a component.
I don’t think that the pawn would need any special component to do this, but maybe it would. I see it as being more unique to the chair needing one, that can attach to and drag with the rest of the object.
I think he implied that all we have to do is touch the chair and it will be picked up magnetically but it would be better to have a user instruction to make that happen, such as a click or button press or better yet, press and hold from the keyboard. I know there is code we can use from C++ libraries, I think getasynckey or something from windows, but that only works on Windows platforms so that’s not good enough.
Anyway we use some if statements- such as “if the pawn is close enough to the component of the chair object”, then “if key is pressed”- and then instruct it to be lifted (raise the vertical plane) and then move in correspondence horizontally with the pawn (but not vertically anymore or on the z axis). Hmm, the lifting action is binary- either up or down, but the lateral is continuous, in the horizontal plane.
So that’s what I can think of. I wonder if we can link the object’s location in 3d space with the pawns location or co-ordinates, just offset by a certain amount- an amount that is fixed in all the relevant planes, at least once the object is grabbed.
Assuming I am even somewhat on track, how would we write the pseudo code for this process? I can see now, coming up with the right method or algorithm is challenging, and then coming up with the pseudo code is a battle in itself, as it gets more specific, and then finding the exact C++ instructions associated with the PseudoCode is the next and last- and then of course refactor. Rome wasn’t built in a day but as a noob, just mapping the problem and getting general stabs at it is huge.
Pseudocode attempt:
Pre-pseudo code: Create component on chair in Unreal Engine
In the header and CPP file:
// determine if the component is in range of the pawn
// determine if the button is pressed that hoists the object
// if those are true, give the formula or mathematical equation that moves the component and object
// link the component of the object with the object in such a way that when the component is moved, the object moves exactly in step with it.
I think that pretty much sums it up. I’m a genius. Well now I’m curious to see what his answer will be and how far off I am, but I’m very glad I wasn’t lazy or in a hurry and attempted this.