I'm continuing my efforts to create an inventory GUI for my little project. I've successfully been able to use a ViewPort to provide a sort of character preview in the inventory menu. I've been able to accomplish this by following poster Rabishan's example found here:
Right now I'm attempting to show the equipped items in the preview screen. However, I've ran into some trouble getting an item to scale correctly. I imagine I'm doing something moronic.
The above code is producing the result as shown in the attached screenshot. Any thoughts on what I may be doing wrong here are, as always, greatly appreciated.
handRMatrix.scale(Players[0].inventory.slot[SLOT_ARM_R]().scale); It looks to me like this is where you are drawing the club. Is that matrix set to the right scale? What happens if you use MatrixIdentity? Better yet, draw the club using the same scale that the guy is being drawn with.
Most likely, it's an issue with having drawn them using 2 different scales.
Well, I was attempting to draw it at the same scale of the actual club item thats in the players inventory.
I suppose its possible that maybe the mesh for the players body I'm using in the preview window is being drawn at a smaller scale than the actual player in game is being drawn at?
In either event, I'll play around with some of the ideas you threw out there. Thanks very much for your thoughts.
Basically, I needed to set the scale of cskel to match that of the player whenever I create it in the viewport. It works pretty decent. The only problems I'm having now is the club isn't quite attaching correctly to the hand in the character preview. Its a little to the left of it instead of actually in it. Thats strange because its virtually the same code that is used to attach it to the player's hand whenever its equipped on the real player, and it works correctly there. So theres that, and I'd like to figure out how to get those darn clouds out of the viewport (and maybe just put a black background color behind it).
Making progress though. =)
(This post was last modified: 09-30-2012 07:57 AM by phleshdef.)
Going back to what I said in my previous post. It seems like, if I scale the club mesh in the viewport the same as the right hand inventory item and I create the cskel in the viewport the same as the players cskel, then everything is the right size.
The problem though, is the club isn't quite in the characters hand in the view port. Now if I don't scale the club at all, its in his hand, but its way huge, like in the screenshot above.
I think whats happening is, I'm attaching the club to his hand, but then when it gets scaled down, its back out of his hand because it got attached at the larger scale.
I tried scaling it first, then attaching it, but that seems to result in the scaling getting reset back to the larger size. Any ideas on that?
This is all working much better for me now. If someone could tell me an easy way to get rid of the sky in the viewport and just have a black background, I'd be one happy camper.
Ah, finally figured out the concept of drawing a reverse box mesh with a texture which solves my sky problem. Tutorials are awesome once you figure out the right one to look at.