# 2 people chat

This topic is 1276 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

HI

I want two people DR1 and DR2 chat. So moving heads towards each other and back to forward. Sometimes randomly they should also look down or up.

So this is where I'm stuck. Other eyes might find a solution for me? There might even be a simpler, completely different approach, well below

I got lost.

Many thanks in advance

if( SDL_GetTicks() - ct > 200 )
{
ct = SDL_GetTicks();

if (rand()%50 == 2 || nun == 1){
nun = 1;
if (ctside <= 0 && still == 0){
DR1value += 0.1;
}else{
if (ctside >= 1 && still == 0){
DR1value -= 0.1;
}
}

if (ctdown == 0 && nun1 == 1){
DR2value += 0.1;
still = 1;
}else{
if (ctdown >= 1){
DR2value -= 0.1;
still = 0;
}
}
}
}
if(DR1value >= 1){
ctside = 1;
nun = 0;
}
if(DR1value <= 0.1){
ctside = 0;
nun1 = rand()%5;
}
if(DR2value >= 1){
ctdown = 1;
nun1 = 0;
}
if(DR2value <= 0.1){
ctdown = 0;
//nun1 = 0;
}

##### Share on other sites

Take an array of images and let a random number decide which to display.

##### Share on other sites

Hmm what do you mean? I've dr1value and dr2value from 0 to 1 so 0.1, 0.2 etc. Probably I need dr3 for looking up and dr4 values for looking down.

##### Share on other sites

Maybe I do misunderstand what you want.

I thought of two images representing two people that move in such a way that it looks like they are talking with each other.

##### Share on other sites

I've two blender meshes/faces looking forward like in a train, car etc. So for talk they should look a little at each other, then back forward and once in a while up or down. They are attached to datarefs for movement. DR1, dr2 etc. from 0 to 1. I only need the logic for movement. Thanks for ideas.

##### Share on other sites

Take me off the list with man with ideas :)

##### Share on other sites

What have you tried? What [b]exactly[/b] are you having difficulty with? (We know what you want to accomplish, now please explain why you're stuck.)

Most importantly: what isn't happening that you want to happen, given the code you posted?

You have not provided enough information for anyone to be helpful.

##### Share on other sites

Imagine a car. The driver and the person aside has a roadmap on the legs. Now they chat a little while driving and the person checks once in a while the map.

We call them DR1 and DR2 which go each from 0-1 for looking sideways. And let's say DR1up/down, DR2up/down  for up/down looking.

My above code looks way unnatural and incomplete. Thanks

##### Share on other sites
Define a center point for each element of the body/face that can move, e.g. eyes, head, neck, arms, and so on. Then define a range of motion for each one. Once you have those numbers, just pick a random position within that range from the "center" for each element. Interpolate from one position to the next over time. When you reach a target position, pause for a random time period, and then pick a new target.

This is just a start, of course; realistically you'll want to couple certain types of movements (head and eyes look down at map while hands raise map slightly, and so on).

##### Share on other sites

DR1/2 always start with 0 and can go up to 1 as I've explained above. Thanks for code examples.

##### Share on other sites

Nobody's writing your code for you. It's a trivial task and if you need more basic help with programming you should be posting in For Beginners.

##### Share on other sites

How silly, of course it's trivial. I was hoping for someone to save me some time or bring a new approach.

##### Share on other sites

This topic is 1276 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Create an account or sign in to comment

You need to be a member in order to leave a comment

## Create an account

Sign up for a new account in our community. It's easy!

Register a new account