有关跟踪两个骷髅以控制游戏的一个对象的帮助。 [英] Help regarding tracking two skeletons to control one object for a game.

查看:74
本文介绍了有关跟踪两个骷髅以控制游戏的一个对象的帮助。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!

推荐答案

这听起来像个有趣的项目:)

This sounds like a fun project :)

我不喜欢没有看到让不同的玩家控制同一"化身"/模型/怪物中的不同肢体的概念的问题。对于kinect提供的每个骨骼,你有20个关节,组成5个不同的部分,如下所示:

I don't see a problem with the concept of having different players control different limbs in the same "avatar"/model/monster. For each skeleton provided by kinect, you have 20 joints which make up 5 different segments, as follows:

骨干:髋关节中心,脊柱,肩部中心,头部为
左腿:臀部中心,左臀部,左膝,左脚踝,左脚

右腿:臀部中心,右臀部,右膝,右脚踝,右脚

左臂:肩中心,左肩,左肘,左手腕,左手

右臂:肩中心,右肩,右肘,右手腕,右手

Backbone: Hip Center, Spine, Shoulder Center, Head
Left Leg: Hip Center, Left Hip, Left Knee, Left Ankle, Left Foot
Right Leg: Hip Center, Right Hip, Right Knee, Right Ankle, Right Foot
Left Arm: Shoulder Center, Left Shoulder, Left Elbow, Left Wrist, Left Hand
Right Arm: Shoulder Center, Right Shoulder, Right Elbow, Right Wrist, Right Hand

所以,根据你指定的一些规则,做你想做的事情似乎你需要一些方法或类来接收2个骷髅并输出1个组合骨架。

So, to do what you want it seems like you need some method or class that takes in 2 skeletons and outputs 1, combined skeleton, according to some rules you'd specify.

第一步是计算骨干关节位置。这听起来并不像是用来控制游戏中的任何东西,所以你可以:

1)根据游戏周围的情况自动分配它们,这是
2)任意挑选其中一个玩家的骨干并将其设置为生物的输出骨干,或者b $ b 3)平均两个玩家的骨干关节位置并称之为输出骨干

First step is to calculate the backbone joint positions. It doesn't sound like these would be used to control anything in the game, so you could:
1) just assign them automatically based on what's happening around the game,
2) arbitrarily pick the backbone of one of the players and set it as the output backbone for creature, or
3) average the backbone joint positions for both players and call that the output backbone

我会从2开始,这应该是最少量的代码,然后从那里进行实验。

I would start with 2, which should be the least amount of code, and then experiment from there.

然后,移植一个右臂对于玩家来说,玩家1,你可以计算该玩家手臂中相邻关节的相对位置向量:

Then, to transplant the right arm of one of the players, let's say player 1, into the creature, you could calculate the relative position vectors for adjacent joints in the arm of that player:

RelativeRightShoulder = RightShoulder1 - ShoulderCenter1

RelativeRightElbow = RightElbow1 - RightShoulder1

RelativeRightWrist =  RightWrist1 - RightElbow1

RelativeRightHand =  RightHand1 - RightWrist1



和t母鸡,因为你已经拥有了生物的骨干关节,你可以使用这些相对位置向量计算生物的关节位置:

RelativeRightShoulder = RightShoulder1 - ShoulderCenter1
RelativeRightElbow = RightElbow1 - RightShoulder1
RelativeRightWrist = RightWrist1 - RightElbow1
RelativeRightHand = RightHand1 - RightWrist1

And then, since you already have the backbone joints for creature, you would use these relative position vectors to compute joint positions for creature as:

CreatureRightShoulder = CreatureShoulderCenter + RelativeRightShoulder

CreatureRightElbow = CreatureRightShoulder + RelativeRightElbow

CreatureRightWrist = CreatureRightElbow + RelativeRightWrist

CreatureRightHand = CreatureRightWrist + RelativeRightHand

CreatureRightShoulder = CreatureShoulderCenter + RelativeRightShoulder
CreatureRightElbow = CreatureRightShoulder + RelativeRightElbow
CreatureRightWrist = CreatureRightElbow + RelativeRightWrist
CreatureRightHand = CreatureRightWrist + RelativeRightHand

然后你做同样的事情其他3个肢体的东西。

And then you do the same kind of thing for other 3 limbs.

让我知道它是怎么回事!
$
Eddy

Let me know how it goes!
Eddy


这篇关于有关跟踪两个骷髅以控制游戏的一个对象的帮助。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆