Jump to content

  • Log In with Google      Sign In   
  • Create Account


2 people chat

  • You cannot reply to this topic
11 replies to this topic

#1 FGFS   Members   -  Reputation: 177

Like
0Likes
Like

Posted 18 June 2014 - 05:16 AM

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;
}

 



Sponsor:

#2 Tribad   Members   -  Reputation: 796

Like
0Likes
Like

Posted 18 June 2014 - 05:32 AM

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



#3 FGFS   Members   -  Reputation: 177

Like
0Likes
Like

Posted 18 June 2014 - 05:37 AM

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.



#4 Tribad   Members   -  Reputation: 796

Like
0Likes
Like

Posted 18 June 2014 - 05:48 AM

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.



#5 FGFS   Members   -  Reputation: 177

Like
0Likes
Like

Posted 18 June 2014 - 06:49 AM

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.



#6 Tribad   Members   -  Reputation: 796

Like
0Likes
Like

Posted 18 June 2014 - 06:57 AM

Take me off the list with man with ideas :)



#7 ApochPiQ   Moderators   -  Reputation: 14273

Like
1Likes
Like

Posted 18 June 2014 - 11:38 AM

What have you tried? What exactly 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.



#8 FGFS   Members   -  Reputation: 177

Like
0Likes
Like

Posted 19 June 2014 - 12:43 AM

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



#9 ApochPiQ   Moderators   -  Reputation: 14273

Like
0Likes
Like

Posted 19 June 2014 - 01:08 AM

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).

#10 FGFS   Members   -  Reputation: 177

Like
-2Likes
Like

Posted 19 June 2014 - 02:46 AM

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



#11 ApochPiQ   Moderators   -  Reputation: 14273

Like
2Likes
Like

Posted 19 June 2014 - 03:05 PM

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.



#12 FGFS   Members   -  Reputation: 177

Like
-2Likes
Like

Posted 20 June 2014 - 12:18 AM

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







PARTNERS